<html><!-- Created using the cpp_pretty_printer from the dlib C++ library.  See http://dlib.net for updates. --><head><title>dlib C++ Library - mex_wrapper.cpp</title></head><body bgcolor='white'><pre>
<font color='#009900'>// Copyright (C) 2012 Massachusetts Institute of Technology, Lincoln Laboratory
</font><font color='#009900'>// License: Boost Software License   See LICENSE.txt for the full license.
</font><font color='#009900'>// Authors: Davis E. King (davis@dlib.net)
</font><font color='#009900'>/*
                               READ THIS FIRST
                                   ######
                                   ######
                                   ######
                                   ######
                                   ######
                                   ######
                                   ######
                                   ######
                                   ######
                                   ######
                                   ######
                                   ######
                                   ######
                               \############/
                                \##########/
                                 \########/
                                  \######/
                                   \####/
                                    \##/
                                     \/

    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    See example_mex_function.cpp for a discussion of how to use the mex wrapper.

    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

                                     /\
                                    /##\
                                   /####\
                                  /######\
                                 /########\
                                /##########\
                               /############\
                                   ######
                                   ######
                                   ######
                                   ######
                                   ######
                                   ######
                                   ######
                                   ######
                                   ######
                                   ######
                                   ######
                                   ######
                                   ######
                               READ THIS FIRST
*/</font>

<font color='#009900'>// Copyright (C) 2012 Massachusetts Institute of Technology, Lincoln Laboratory
</font><font color='#009900'>// License: Boost Software License   See LICENSE.txt for the full license.
</font><font color='#009900'>// Authors: Davis E. King (davis@dlib.net)
</font>


































<font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>//                            BEGIN IMPLEMENTATION DETAILS
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../matrix.h.html'>../matrix.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../array2d.h.html'>../array2d.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../array.h.html'>../array.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../image_transforms.h.html'>../image_transforms.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../is_kind.h.html'>../is_kind.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../string.h.html'>../string.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../any.h.html'>../any.h</a>" <font color='#009900'>// for sig_traits
</font><font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../hash.h.html'>../hash.h</a>"
<font color='#0000FF'>#include</font> <font color='#5555FF'>&lt;</font>tuple<font color='#5555FF'>&gt;</font>
<font color='#0000FF'>#include</font> <font color='#5555FF'>&lt;</font>map<font color='#5555FF'>&gt;</font>

<font color='#0000FF'>#if</font> defined<font face='Lucida Console'>(</font>_MSC_VER<font face='Lucida Console'>)</font>
<font color='#0000FF'>#define</font> DLL_EXPORT_SYM __declspec<font face='Lucida Console'>(</font>dllexport<font face='Lucida Console'>)</font>
<font color='#0000FF'>#endif</font>
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='mex.h.html'>mex.h</a>"
<font color='#0000FF'>#include</font> <font color='#5555FF'>&lt;</font>sstream<font color='#5555FF'>&gt;</font>
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='call_matlab.h.html'>call_matlab.h</a>"

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>#ifdef</font> ARG_1_DEFAULT 
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_1 <font color='#0000FF'>else</font> A1 <font color='#5555FF'>=</font> ARG_1_DEFAULT;
<font color='#0000FF'>#else</font>
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_1
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#ifdef</font> ARG_2_DEFAULT 
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_2 <font color='#0000FF'>else</font> A2 <font color='#5555FF'>=</font> ARG_2_DEFAULT;
<font color='#0000FF'>#else</font>
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_2
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#ifdef</font> ARG_3_DEFAULT 
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_3 <font color='#0000FF'>else</font> A3 <font color='#5555FF'>=</font> ARG_3_DEFAULT;
<font color='#0000FF'>#else</font>
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_3
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#ifdef</font> ARG_4_DEFAULT 
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_4 <font color='#0000FF'>else</font> A4 <font color='#5555FF'>=</font> ARG_4_DEFAULT;
<font color='#0000FF'>#else</font>
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_4
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#ifdef</font> ARG_5_DEFAULT 
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_5 <font color='#0000FF'>else</font> A5 <font color='#5555FF'>=</font> ARG_5_DEFAULT;
<font color='#0000FF'>#else</font>
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_5
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#ifdef</font> ARG_6_DEFAULT 
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_6 <font color='#0000FF'>else</font> A6 <font color='#5555FF'>=</font> ARG_6_DEFAULT;
<font color='#0000FF'>#else</font>
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_6
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#ifdef</font> ARG_7_DEFAULT 
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_7 <font color='#0000FF'>else</font> A7 <font color='#5555FF'>=</font> ARG_7_DEFAULT;
<font color='#0000FF'>#else</font>
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_7
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#ifdef</font> ARG_8_DEFAULT 
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_8 <font color='#0000FF'>else</font> A8 <font color='#5555FF'>=</font> ARG_8_DEFAULT;
<font color='#0000FF'>#else</font>
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_8
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#ifdef</font> ARG_9_DEFAULT 
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_9 <font color='#0000FF'>else</font> A9 <font color='#5555FF'>=</font> ARG_9_DEFAULT;
<font color='#0000FF'>#else</font>
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_9
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#ifdef</font> ARG_10_DEFAULT 
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_10 <font color='#0000FF'>else</font> A10 <font color='#5555FF'>=</font> ARG_10_DEFAULT;
<font color='#0000FF'>#else</font>
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_10
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#ifdef</font> ARG_11_DEFAULT 
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_11 <font color='#0000FF'>else</font> A11 <font color='#5555FF'>=</font> ARG_11_DEFAULT;
<font color='#0000FF'>#else</font>
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_11
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#ifdef</font> ARG_12_DEFAULT 
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_12 <font color='#0000FF'>else</font> A12 <font color='#5555FF'>=</font> ARG_12_DEFAULT;
<font color='#0000FF'>#else</font>
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_12
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#ifdef</font> ARG_13_DEFAULT 
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_13 <font color='#0000FF'>else</font> A13 <font color='#5555FF'>=</font> ARG_13_DEFAULT;
<font color='#0000FF'>#else</font>
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_13
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#ifdef</font> ARG_14_DEFAULT 
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_14 <font color='#0000FF'>else</font> A14 <font color='#5555FF'>=</font> ARG_14_DEFAULT;
<font color='#0000FF'>#else</font>
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_14
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#ifdef</font> ARG_15_DEFAULT 
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_15 <font color='#0000FF'>else</font> A15 <font color='#5555FF'>=</font> ARG_15_DEFAULT;
<font color='#0000FF'>#else</font>
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_15
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#ifdef</font> ARG_16_DEFAULT 
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_16 <font color='#0000FF'>else</font> A16 <font color='#5555FF'>=</font> ARG_16_DEFAULT;
<font color='#0000FF'>#else</font>
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_16
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#ifdef</font> ARG_17_DEFAULT 
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_17 <font color='#0000FF'>else</font> A17 <font color='#5555FF'>=</font> ARG_17_DEFAULT;
<font color='#0000FF'>#else</font>
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_17
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#ifdef</font> ARG_18_DEFAULT 
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_18 <font color='#0000FF'>else</font> A18 <font color='#5555FF'>=</font> ARG_18_DEFAULT;
<font color='#0000FF'>#else</font>
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_18
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#ifdef</font> ARG_19_DEFAULT 
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_19 <font color='#0000FF'>else</font> A19 <font color='#5555FF'>=</font> ARG_19_DEFAULT;
<font color='#0000FF'>#else</font>
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_19
<font color='#0000FF'>#endif</font>

<font color='#0000FF'>#ifdef</font> ARG_20_DEFAULT 
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_20 <font color='#0000FF'>else</font> A20 <font color='#5555FF'>=</font> ARG_20_DEFAULT;
<font color='#0000FF'>#else</font>
<font color='#0000FF'>#define</font> ELSE_ASSIGN_ARG_20
<font color='#0000FF'>#endif</font>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>namespace</font> mex_binding
<b>{</b>
    <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> dlib;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='is_input_type'></a>is_input_type</b> 
    <b>{</b>
        <font color='#0000FF'>const</font> <font color='#0000FF'>static</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> value <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font>is_same_type<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font>,T<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font>is_reference_type<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font> is_const_type<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value <font face='Lucida Console'>)</font><font face='Lucida Console'>)</font> ? <font color='#979000'>1</font> : <font color='#979000'>0</font>;
    <b>}</b>;
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='is_output_type'></a>is_output_type</b> 
    <b>{</b>
        <font color='#0000FF'>const</font> <font color='#0000FF'>static</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> value <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font>is_same_type<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font>,T<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_reference_type<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#5555FF'>!</font>is_const_type<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> ? <font color='#979000'>1</font> : <font color='#979000'>0</font>;
    <b>}</b>;


    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='funct_traits'></a>funct_traits</b>
    <b>{</b>
        <font color='#0000FF'>const</font> <font color='#0000FF'>static</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> num_inputs <font color='#5555FF'>=</font> is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font>
            is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font>
            is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font>
            is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg4_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font>
            is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg5_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font>
            is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg6_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font>
            is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg7_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font>
            is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg8_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font>
            is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg9_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font>
            is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg10_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font> 
            is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg11_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font> 
            is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg12_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font> 
            is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg13_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font> 
            is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg14_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font> 
            is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg15_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font> 
            is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg16_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font> 
            is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg17_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font> 
            is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg18_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font> 
            is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg19_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font> 
            is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg20_type<font color='#5555FF'>&gt;</font>::value; 

        <font color='#0000FF'>const</font> <font color='#0000FF'>static</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> num_outputs<font color='#5555FF'>=</font> is_output_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font>
            is_output_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font>
            is_output_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font>
            is_output_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg4_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font>
            is_output_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg5_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font>
            is_output_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg6_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font>
            is_output_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg7_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font>
            is_output_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg8_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font>
            is_output_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg9_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font>
            is_output_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg10_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font> 
            is_output_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg11_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font> 
            is_output_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg12_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font> 
            is_output_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg13_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font> 
            is_output_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg14_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font> 
            is_output_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg15_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font> 
            is_output_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg16_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font> 
            is_output_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg17_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font> 
            is_output_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg18_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font> 
            is_output_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg19_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>+</font> 
            is_output_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg20_type<font color='#5555FF'>&gt;</font>::value; 
    <b>}</b>;

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='is_array_type'></a>is_array_type</b>
    <b>{</b>
        <font color='#009900'>// true if T is std::vector or dlib::array
</font>        <font color='#0000FF'>const</font> <font color='#0000FF'>static</font> <font color='#0000FF'><u>bool</u></font> value <font color='#5555FF'>=</font> is_std_vector<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font> dlib::is_array<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value;

    <b>}</b>;

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T,
        <font color='#0000FF'>typename</font> enabled <font color='#5555FF'>=</font> <font color='#0000FF'><u>void</u></font> 
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='inner_type'></a>inner_type</b>
    <b>{</b>
        <font color='#0000FF'>typedef</font> T type;
    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font> <font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='inner_type'></a>inner_type</b><font color='#5555FF'>&lt;</font>T, <font color='#0000FF'>typename</font> dlib::enable_if_c<font color='#5555FF'>&lt;</font>is_matrix<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font> is_array2d<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font> dlib::is_array<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&gt;</font>::type<font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> T::type type;
    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font> <font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='inner_type'></a>inner_type</b><font color='#5555FF'>&lt;</font>T, <font color='#0000FF'>typename</font> dlib::enable_if<font color='#5555FF'>&lt;</font>is_std_vector<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font> <font color='#5555FF'>&gt;</font>::type<font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> T::value_type type;
    <b>}</b>;


<font color='#009900'>// -------------------------------------------------------
</font>
    <font color='#0000FF'>struct</font> <b><a name='user_hit_ctrl_c'></a>user_hit_ctrl_c</b> <b>{</b><b>}</b>;

    <font color='#0000FF'>struct</font> <b><a name='invalid_args_exception'></a>invalid_args_exception</b>
    <b>{</b>
        <b><a name='invalid_args_exception'></a>invalid_args_exception</b><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> msg_<font face='Lucida Console'>)</font>: msg<font face='Lucida Console'>(</font>msg_<font face='Lucida Console'>)</font> <b>{</b><b>}</b>
        std::string msg;
    <b>}</b>;

<font color='#009900'>// -------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='validate_and_populate_arg'></a>validate_and_populate_arg</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'><u>long</u></font> arg_idx,
        <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs,
        T<font color='#5555FF'>&amp;</font> arg
    <font face='Lucida Console'>)</font>; 

<font color='#009900'>// -------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='is_column_major_matrix'></a>is_column_major_matrix</b> : <font color='#0000FF'>public</font> default_is_kind_value <b>{</b><b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T,
        <font color='#0000FF'><u>long</u></font> num_rows,
        <font color='#0000FF'><u>long</u></font> num_cols,
        <font color='#0000FF'>typename</font> mem_manager
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='is_column_major_matrix'></a>is_column_major_matrix</b><font color='#5555FF'>&lt;</font>matrix<font color='#5555FF'>&lt;</font>T,num_rows,num_cols,mem_manager,column_major_layout<font color='#5555FF'>&gt;</font> <font color='#5555FF'>&gt;</font> 
    <b>{</b> <font color='#0000FF'>static</font> <font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font> value <font color='#5555FF'>=</font> <font color='#979000'>true</font>; <b>}</b>; 

<font color='#009900'>// -------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> matrix_type,
        <font color='#0000FF'>typename</font> EXP
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>typename</font> dlib::enable_if_c<font color='#5555FF'>&lt;</font>is_matrix<font color='#5555FF'>&lt;</font>matrix_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_same_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> inner_type<font color='#5555FF'>&lt;</font>matrix_type<font color='#5555FF'>&gt;</font>::type,<font color='#0000FF'>typename</font> EXP::type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&gt;</font>::type
    <b><a name='assign_mat'></a>assign_mat</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> arg_idx,
        matrix_type<font color='#5555FF'>&amp;</font> m,
        <font color='#0000FF'>const</font> matrix_exp<font color='#5555FF'>&lt;</font>EXP<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> src
    <font face='Lucida Console'>)</font>  
    <b>{</b>
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>matrix_type::NR <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font> <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> matrix_type::NR <font color='#5555FF'>!</font><font color='#5555FF'>=</font> src.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
        <b>{</b>
            std::ostringstream sout;
            sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>Argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> expects a matrix with </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> matrix_type::NR <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> rows but got one with </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> src.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mexErrMsgIdAndTxt</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>mex_function:validate_and_populate_arg</font>",
                              sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>matrix_type::NC <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font> <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> matrix_type::NC <font color='#5555FF'>!</font><font color='#5555FF'>=</font> src.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
        <b>{</b>
            std::ostringstream sout;
            sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>Argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> expects a matrix with </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> matrix_type::NC <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> columns but got one with </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> src.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mexErrMsgIdAndTxt</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>mex_function:validate_and_populate_arg</font>",
                              sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        <b>}</b>


        m <font color='#5555FF'>=</font> <font color='#BB00BB'>trans</font><font face='Lucida Console'>(</font>src<font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> matrix_type,
        <font color='#0000FF'>typename</font> EXP
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>typename</font> dlib::enable_if_c<font color='#5555FF'>&lt;</font>is_array2d<font color='#5555FF'>&lt;</font>matrix_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_same_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> inner_type<font color='#5555FF'>&lt;</font>matrix_type<font color='#5555FF'>&gt;</font>::type,<font color='#0000FF'>typename</font> EXP::type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&gt;</font>::type
    <b><a name='assign_mat'></a>assign_mat</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> arg_idx,
        matrix_type<font color='#5555FF'>&amp;</font> m,
        <font color='#0000FF'>const</font> matrix_exp<font color='#5555FF'>&lt;</font>EXP<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> src
    <font face='Lucida Console'>)</font>  
    <b>{</b>
        <font color='#BB00BB'>assign_image</font><font face='Lucida Console'>(</font>m , <font color='#BB00BB'>trans</font><font face='Lucida Console'>(</font>src<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> matrix_type,
        <font color='#0000FF'>typename</font> EXP
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>typename</font> disable_if_c<font color='#5555FF'>&lt;</font><font face='Lucida Console'>(</font>is_array2d<font color='#5555FF'>&lt;</font>matrix_type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font> is_matrix<font color='#5555FF'>&lt;</font>matrix_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> 
    is_same_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> inner_type<font color='#5555FF'>&lt;</font>matrix_type<font color='#5555FF'>&gt;</font>::type,<font color='#0000FF'>typename</font> EXP::type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&gt;</font>::type
    <b><a name='assign_mat'></a>assign_mat</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> arg_idx,
        matrix_type<font color='#5555FF'>&amp;</font> ,
        <font color='#0000FF'>const</font> matrix_exp<font color='#5555FF'>&lt;</font>EXP<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> 
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        std::ostringstream sout;
        sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>mex_function has some bug in it related to processing input argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font>;
        <font color='#BB00BB'>mexErrMsgIdAndTxt</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>mex_function:validate_and_populate_arg</font>",
                          sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
    <b>}</b>


<font color='#009900'>// -------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T,
        <font color='#0000FF'>typename</font> U
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>typename</font> dlib::enable_if_c<font color='#5555FF'>&lt;</font>is_built_in_scalar_type<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font> is_same_type<font color='#5555FF'>&lt;</font>T,<font color='#0000FF'><u>bool</u></font><font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&gt;</font>::type
    <b><a name='assign_scalar'></a>assign_scalar</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> arg_idx,
        T<font color='#5555FF'>&amp;</font> dest,
        <font color='#0000FF'>const</font> U<font color='#5555FF'>&amp;</font> src
    <font face='Lucida Console'>)</font>  
    <b>{</b>
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_signed_type<font color='#5555FF'>&lt;</font>U<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> src <font color='#5555FF'>&lt;</font> <font color='#979000'>0</font> <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_unsigned_type<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>
        <b>{</b>
            std::ostringstream sout;
            sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>Error, input argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> must be a non-negative number.</font>";
            <font color='#BB00BB'>mexErrMsgIdAndTxt</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>mex_function:validate_and_populate_arg</font>",
                              sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>else</font>
        <b>{</b>
            dest <font color='#5555FF'>=</font> src;
        <b>}</b>
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T,
        <font color='#0000FF'>typename</font> U
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>typename</font> dlib::disable_if_c<font color='#5555FF'>&lt;</font>is_built_in_scalar_type<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font> is_same_type<font color='#5555FF'>&lt;</font>T,<font color='#0000FF'><u>bool</u></font><font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&gt;</font>::type
    <b><a name='assign_scalar'></a>assign_scalar</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> arg_idx,
        T<font color='#5555FF'>&amp;</font> ,
        <font color='#0000FF'>const</font> U<font color='#5555FF'>&amp;</font> 
    <font face='Lucida Console'>)</font>  
    <b>{</b>
        std::ostringstream sout;
        sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>mex_function has some bug in it related to processing input argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font>;
        <font color='#BB00BB'>mexErrMsgIdAndTxt</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>mex_function:validate_and_populate_arg</font>",
                          sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
    <b>}</b>


<font color='#009900'>// -------------------------------------------------------
</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='assign_function_handle'></a>assign_function_handle</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> arg_idx,
        function_handle<font color='#5555FF'>&amp;</font> dest,
        <font color='#0000FF'>const</font> mxArray<font color='#5555FF'>*</font> src
    <font face='Lucida Console'>)</font>  
    <b>{</b>
        <font color='#0000FF'>const_cast</font><font color='#5555FF'>&lt;</font><font color='#0000FF'><u>void</u></font><font color='#5555FF'>*</font><font color='#5555FF'>&amp;</font><font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>dest.h<font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>void</u></font><font color='#5555FF'>*</font><font face='Lucida Console'>)</font>src;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='assign_function_handle'></a>assign_function_handle</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> arg_idx,
        T<font color='#5555FF'>&amp;</font> ,
        <font color='#0000FF'>const</font> mxArray<font color='#5555FF'>*</font> 
    <font face='Lucida Console'>)</font>  
    <b>{</b>
        std::ostringstream sout;
        sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>mex_function has some bug in it related to processing input argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font>;
        <font color='#BB00BB'>mexErrMsgIdAndTxt</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>mex_function:validate_and_populate_arg</font>",
                          sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
    <b>}</b>


<font color='#009900'>// -------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>typename</font> dlib::enable_if<font color='#5555FF'>&lt;</font>is_array_type<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font> <font color='#5555FF'>&gt;</font>::type
    <b><a name='assign_std_vector'></a>assign_std_vector</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> arg_idx,
        T<font color='#5555FF'>&amp;</font> dest,
        <font color='#0000FF'>const</font> mxArray<font color='#5555FF'>*</font> src
    <font face='Lucida Console'>)</font>  
    <b>{</b>
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> nr <font color='#5555FF'>=</font> <font color='#BB00BB'>mxGetM</font><font face='Lucida Console'>(</font>src<font face='Lucida Console'>)</font>;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> nc <font color='#5555FF'>=</font> <font color='#BB00BB'>mxGetN</font><font face='Lucida Console'>(</font>src<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> inner_type<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::type type;

        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font><font color='#BB00BB'>mxIsCell</font><font face='Lucida Console'>(</font>src<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
        <b>{</b>
            std::ostringstream sout;
            sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> must be a cell array</font>";
            <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>nr <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>1</font> <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> nc <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>1</font><font face='Lucida Console'>)</font>
        <b>{</b>
            std::ostringstream sout;
            sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> must be a cell array with exactly 1 row or 1 column (i.e. a row or column vector)</font>";
            <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        <b>}</b>

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> size <font color='#5555FF'>=</font> nr<font color='#5555FF'>*</font>nc;
        dest.<font color='#BB00BB'>resize</font><font face='Lucida Console'>(</font>size<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>; i <font color='#5555FF'>&lt;</font> dest.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'>try</font>
            <b>{</b>
                <font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i, <font color='#BB00BB'>mxGetCell</font><font face='Lucida Console'>(</font>src, i<font face='Lucida Console'>)</font>, dest[i]<font face='Lucida Console'>)</font>;
            <b>}</b>
            <font color='#0000FF'>catch</font> <font face='Lucida Console'>(</font>invalid_args_exception<font color='#5555FF'>&amp;</font> e<font face='Lucida Console'>)</font>
            <b>{</b>
                std::ostringstream sout;
                sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>Error in argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>: element </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> i<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> of cell array not the expected type.\n</font>";
                sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\t</font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> e.msg;
                <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <b>}</b>
        <b>}</b>

    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>typename</font> disable_if<font color='#5555FF'>&lt;</font>is_array_type<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font> <font color='#5555FF'>&gt;</font>::type
    <b><a name='assign_std_vector'></a>assign_std_vector</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> arg_idx,
        T<font color='#5555FF'>&amp;</font> ,
        <font color='#0000FF'>const</font> mxArray<font color='#5555FF'>*</font>
    <font face='Lucida Console'>)</font>  
    <b>{</b>
        std::ostringstream sout;
        sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>mex_function has some bug in it related to processing input argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font>;
        <font color='#BB00BB'>mexErrMsgIdAndTxt</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>mex_function:validate_and_populate_arg</font>",
                          sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
    <b>}</b>

<font color='#009900'>// -------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font> 
    <font color='#0000FF'><u>void</u></font> <b><a name='assign_image'></a>assign_image</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> arg_idx,
        T<font color='#5555FF'>&amp;</font>,
        <font color='#0000FF'>const</font> dlib::uint8<font color='#5555FF'>*</font> data,
        <font color='#0000FF'><u>long</u></font> nr,
        <font color='#0000FF'><u>long</u></font> nc
    <font face='Lucida Console'>)</font>
    <b>{</b>
        std::ostringstream sout;
        sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>mex_function has some bug in it related to processing input argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font>;
        <font color='#BB00BB'>mexErrMsgIdAndTxt</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>mex_function:validate_and_populate_arg</font>",
                          sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> MM<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='assign_image'></a>assign_image</b><font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> ,
        array2d<font color='#5555FF'>&lt;</font>dlib::rgb_pixel,MM<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> img,
        <font color='#0000FF'>const</font> dlib::uint8<font color='#5555FF'>*</font> data,
        <font color='#0000FF'><u>long</u></font> nr,
        <font color='#0000FF'><u>long</u></font> nc
    <font face='Lucida Console'>)</font>
    <b>{</b>
        img.<font color='#BB00BB'>set_size</font><font face='Lucida Console'>(</font>nr, nc<font face='Lucida Console'>)</font>;
        <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> c <font color='#5555FF'>=</font> <font color='#979000'>0</font>; c <font color='#5555FF'>&lt;</font> img.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>c<font face='Lucida Console'>)</font>
            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> r <font color='#5555FF'>=</font> <font color='#979000'>0</font>; r <font color='#5555FF'>&lt;</font> img.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>r<font face='Lucida Console'>)</font>
                img[r][c].red <font color='#5555FF'>=</font> <font color='#5555FF'>*</font>data<font color='#5555FF'>+</font><font color='#5555FF'>+</font>;
        <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> c <font color='#5555FF'>=</font> <font color='#979000'>0</font>; c <font color='#5555FF'>&lt;</font> img.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>c<font face='Lucida Console'>)</font>
            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> r <font color='#5555FF'>=</font> <font color='#979000'>0</font>; r <font color='#5555FF'>&lt;</font> img.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>r<font face='Lucida Console'>)</font>
                img[r][c].green <font color='#5555FF'>=</font> <font color='#5555FF'>*</font>data<font color='#5555FF'>+</font><font color='#5555FF'>+</font>;
        <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> c <font color='#5555FF'>=</font> <font color='#979000'>0</font>; c <font color='#5555FF'>&lt;</font> img.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>c<font face='Lucida Console'>)</font>
            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> r <font color='#5555FF'>=</font> <font color='#979000'>0</font>; r <font color='#5555FF'>&lt;</font> img.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>r<font face='Lucida Console'>)</font>
                img[r][c].blue <font color='#5555FF'>=</font> <font color='#5555FF'>*</font>data<font color='#5555FF'>+</font><font color='#5555FF'>+</font>;
    <b>}</b>

<font color='#009900'>// -------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_private_set_mxArray'></a>call_private_set_mxArray</b><font face='Lucida Console'>(</font>T<font color='#5555FF'>&amp;</font>, mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font> <b>{</b><b>}</b>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_private_set_mxArray'></a>call_private_set_mxArray</b><font face='Lucida Console'>(</font>matrix_colmajor<font color='#5555FF'>&amp;</font> item, mxArray<font color='#5555FF'>*</font> m<font face='Lucida Console'>)</font> <b>{</b> item.<font color='#BB00BB'>_private_set_mxArray</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>; <b>}</b>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_private_set_mxArray'></a>call_private_set_mxArray</b><font face='Lucida Console'>(</font>fmatrix_colmajor<font color='#5555FF'>&amp;</font> item, mxArray<font color='#5555FF'>*</font> m<font face='Lucida Console'>)</font> <b>{</b> item.<font color='#BB00BB'>_private_set_mxArray</font><font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font>; <b>}</b>

<font color='#009900'>// -------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='validate_and_populate_arg'></a>validate_and_populate_arg</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'><u>long</u></font> arg_idx,
        <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs,
        T<font color='#5555FF'>&amp;</font> arg
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_built_in_scalar_type<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font> is_same_type<font color='#5555FF'>&lt;</font>T,<font color='#0000FF'><u>bool</u></font><font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'>if</font><font face='Lucida Console'>(</font> <font color='#5555FF'>!</font><font face='Lucida Console'>(</font><font color='#BB00BB'>mxIsDouble</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font> <font color='#BB00BB'>mxIsSingle</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font> <font color='#BB00BB'>mxIsLogical</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font> <font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font> 
                <font color='#BB00BB'>mxIsComplex</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font>
                <font color='#BB00BB'>mxGetNumberOfElements</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font><font color='#5555FF'>!</font><font color='#5555FF'>=</font><font color='#979000'>1</font> <font face='Lucida Console'>)</font> 
            <b>{</b>
                std::ostringstream sout;
                sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> must be a scalar</font>";
                <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <b>}</b>

            <font color='#BB00BB'>assign_scalar</font><font face='Lucida Console'>(</font>arg_idx, arg , <font color='#BB00BB'>mxGetScalar</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_matrix<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font> is_array2d<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> inner_type<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::type type;

            <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_dims <font color='#5555FF'>=</font> <font color='#BB00BB'>mxGetNumberOfDimensions</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> nr <font color='#5555FF'>=</font> <font color='#BB00BB'>mxGetM</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> nc <font color='#5555FF'>=</font> <font color='#BB00BB'>mxGetN</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>;

            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type,dlib::rgb_pixel<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font><font face='Lucida Console'>(</font>num_dims <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>3</font> <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#BB00BB'>mxGetDimensions</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>[<font color='#979000'>2</font>] <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>3</font> <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#BB00BB'>mxIsUint8</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
                <b>{</b>
                    std::ostringstream sout;
                    sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> must be a 3-D NxMx3 image matrix of uint8</font>";
                    <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
                <b>}</b>

                <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> rows <font color='#5555FF'>=</font> <font color='#BB00BB'>mxGetDimensions</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>[<font color='#979000'>0</font>];
                <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> cols <font color='#5555FF'>=</font> <font color='#BB00BB'>mxGetDimensions</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>[<font color='#979000'>1</font>];
                <font color='#BB00BB'>assign_image</font><font face='Lucida Console'>(</font>arg_idx, arg , <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> dlib::uint8<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>, rows, cols<font face='Lucida Console'>)</font>;
                <font color='#0000FF'>return</font>;
            <b>}</b>

            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>num_dims <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>2</font><font face='Lucida Console'>)</font>
            <b>{</b>
                std::ostringstream sout;
                sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> must be a 2-D matrix (got a </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> num_dims <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>-D matrix)</font>";
                <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <b>}</b>


            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type,<font color='#0000FF'><u>double</u></font><font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font><font color='#BB00BB'>mxIsDouble</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font> <font color='#BB00BB'>mxIsComplex</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
                <b>{</b>
                    std::ostringstream sout;
                    sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> must be a matrix of doubles</font>";
                    <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
                <b>}</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_column_major_matrix<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>
                    <font color='#BB00BB'>call_private_set_mxArray</font><font face='Lucida Console'>(</font>arg, <font face='Lucida Console'>(</font>mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>prhs<font face='Lucida Console'>)</font>;
                <font color='#0000FF'>else</font>
                    <font color='#BB00BB'>assign_mat</font><font face='Lucida Console'>(</font>arg_idx, arg , <font color='#BB00BB'>pointer_to_matrix</font><font face='Lucida Console'>(</font><font color='#BB00BB'>mxGetPr</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>, nc, nr<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <b>}</b>
            <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type, <font color='#0000FF'><u>float</u></font><font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font><font color='#BB00BB'>mxIsSingle</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font> <font color='#BB00BB'>mxIsComplex</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
                <b>{</b>
                    std::ostringstream sout;
                    sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> must be a matrix of single/float</font>";
                    <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
                <b>}</b>

                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_column_major_matrix<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>
                    <font color='#BB00BB'>call_private_set_mxArray</font><font face='Lucida Console'>(</font>arg,<font face='Lucida Console'>(</font>mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>prhs<font face='Lucida Console'>)</font>;
                <font color='#0000FF'>else</font>
                    <font color='#BB00BB'>assign_mat</font><font face='Lucida Console'>(</font>arg_idx, arg , <font color='#BB00BB'>pointer_to_matrix</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> <font color='#0000FF'><u>float</u></font><font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>, nc, nr<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <b>}</b>
            <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type, <font color='#0000FF'><u>bool</u></font><font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font><font color='#BB00BB'>mxIsLogical</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
                <b>{</b>
                    std::ostringstream sout;
                    sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> must be a matrix of logical elements.</font>";
                    <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
                <b>}</b>
                <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font><font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font>mxLogical<font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>bool</u></font><font face='Lucida Console'>)</font>,"<font color='#CC0000'>logical matrices are not supported by the mex wrapper when mxLogical isn't a bool.</font>"<font face='Lucida Console'>)</font>;

                <font color='#BB00BB'>assign_mat</font><font face='Lucida Console'>(</font>arg_idx, arg , <font color='#BB00BB'>pointer_to_matrix</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> <font color='#0000FF'><u>bool</u></font><font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>, nc, nr<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <b>}</b>
            <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type, dlib::uint8<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font><font color='#BB00BB'>mxIsUint8</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font> <font color='#BB00BB'>mxIsComplex</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
                <b>{</b>
                    std::ostringstream sout;
                    sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> must be a matrix of uint8</font>";
                    <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
                <b>}</b>

                <font color='#BB00BB'>assign_mat</font><font face='Lucida Console'>(</font>arg_idx, arg , <font color='#BB00BB'>pointer_to_matrix</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> dlib::uint8<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>, nc, nr<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <b>}</b>
            <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type, dlib::int8<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font><font color='#BB00BB'>mxIsInt8</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font> <font color='#BB00BB'>mxIsComplex</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
                <b>{</b>
                    std::ostringstream sout;
                    sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> must be a matrix of int8</font>";
                    <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
                <b>}</b>

                <font color='#BB00BB'>assign_mat</font><font face='Lucida Console'>(</font>arg_idx, arg , <font color='#BB00BB'>pointer_to_matrix</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> dlib::int8<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>, nc, nr<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <b>}</b>
            <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type, dlib::int16<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font>
                    <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type, <font color='#0000FF'><u>short</u></font><font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>short</u></font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font>dlib::int16<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font><font color='#BB00BB'>mxIsInt16</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font> <font color='#BB00BB'>mxIsComplex</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
                <b>{</b>
                    std::ostringstream sout;
                    sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> must be a matrix of int16</font>";
                    <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
                <b>}</b>

                <font color='#BB00BB'>assign_mat</font><font face='Lucida Console'>(</font>arg_idx, arg , <font color='#BB00BB'>pointer_to_matrix</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> type<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>, nc, nr<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <b>}</b>
            <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type, dlib::uint16<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font>
                    <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type, <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>short</u></font><font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>short</u></font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font>dlib::uint16<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font><font color='#BB00BB'>mxIsUint16</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font> <font color='#BB00BB'>mxIsComplex</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
                <b>{</b>
                    std::ostringstream sout;
                    sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> must be a matrix of uint16</font>";
                    <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
                <b>}</b>

                <font color='#BB00BB'>assign_mat</font><font face='Lucida Console'>(</font>arg_idx, arg , <font color='#BB00BB'>pointer_to_matrix</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> type<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>, nc, nr<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <b>}</b>
            <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type, dlib::int32<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font>
                    <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type, <font color='#0000FF'><u>int</u></font><font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>int</u></font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font>dlib::int32<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font>
                    <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type, <font color='#0000FF'><u>long</u></font><font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font>dlib::int32<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font><font color='#BB00BB'>mxIsInt32</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font> <font color='#BB00BB'>mxIsComplex</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
                <b>{</b>
                    std::ostringstream sout;
                    sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> must be a matrix of int32</font>";
                    <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
                <b>}</b>

                <font color='#BB00BB'>assign_mat</font><font face='Lucida Console'>(</font>arg_idx, arg , <font color='#BB00BB'>pointer_to_matrix</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> type<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>, nc, nr<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <b>}</b>
            <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type, dlib::uint32<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font>
                    <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type, <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>int</u></font><font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>int</u></font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font>dlib::uint32<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font>
                    <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type, <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font><font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font>dlib::uint32<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font><font color='#BB00BB'>mxIsUint32</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font> <font color='#BB00BB'>mxIsComplex</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
                <b>{</b>
                    std::ostringstream sout;
                    sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> must be a matrix of uint32</font>";
                    <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
                <b>}</b>

                <font color='#BB00BB'>assign_mat</font><font face='Lucida Console'>(</font>arg_idx, arg , <font color='#BB00BB'>pointer_to_matrix</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> type<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>, nc, nr<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <b>}</b>
            <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type, dlib::uint64<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font>
                    <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type, <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>int</u></font><font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>int</u></font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font>dlib::uint64<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font>
                    <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type, <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font><font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font>dlib::uint64<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font><font color='#BB00BB'>mxIsUint64</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font> <font color='#BB00BB'>mxIsComplex</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
                <b>{</b>
                    std::ostringstream sout;
                    sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> must be a matrix of uint64</font>";
                    <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
                <b>}</b>

                <font color='#BB00BB'>assign_mat</font><font face='Lucida Console'>(</font>arg_idx, arg , <font color='#BB00BB'>pointer_to_matrix</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> type<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>, nc, nr<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <b>}</b>
            <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type, dlib::int64<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font>
                    <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type, <font color='#0000FF'><u>int</u></font><font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>int</u></font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font>dlib::int64<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font>
                    <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>type, <font color='#0000FF'><u>long</u></font><font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font>dlib::int64<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font><font color='#BB00BB'>mxIsInt64</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font> <font color='#BB00BB'>mxIsComplex</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
                <b>{</b>
                    std::ostringstream sout;
                    sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> must be a matrix of int64</font>";
                    <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
                <b>}</b>

                <font color='#BB00BB'>assign_mat</font><font face='Lucida Console'>(</font>arg_idx, arg , <font color='#BB00BB'>pointer_to_matrix</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> type<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>, nc, nr<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <b>}</b>
            <font color='#0000FF'>else</font>
            <b>{</b>
                <font color='#BB00BB'>mexErrMsgIdAndTxt</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>mex_function:validate_and_populate_arg</font>",
                                  "<font color='#CC0000'>mex_function uses unsupported matrix type</font>"<font face='Lucida Console'>)</font>;
            <b>}</b>
        <b>}</b>
        <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_array_type<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#BB00BB'>assign_std_vector</font><font face='Lucida Console'>(</font>arg_idx, arg, prhs<font face='Lucida Console'>)</font>;

        <b>}</b>
        <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>T,function_handle<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font><font color='#BB00BB'>mxIsClass</font><font face='Lucida Console'>(</font>prhs, "<font color='#CC0000'>function_handle</font>"<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
            <b>{</b>
                std::ostringstream sout;
                sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> must be a function handle.</font>";
                <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <b>}</b>
            <font color='#BB00BB'>assign_function_handle</font><font face='Lucida Console'>(</font>arg_idx, arg, prhs<font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>else</font>
        <b>{</b>
            <font color='#BB00BB'>mexErrMsgIdAndTxt</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>mex_function:validate_and_populate_arg</font>",
                              "<font color='#CC0000'>mex_function uses unsupported input argument type</font>"<font face='Lucida Console'>)</font>;
        <b>}</b>
    <b>}</b>

    <font color='#0000FF'><u>void</u></font> <b><a name='validate_and_populate_arg'></a>validate_and_populate_arg</b><font face='Lucida Console'>(</font>
        <font color='#0000FF'><u>long</u></font> arg_idx,
        <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs,
        matlab_struct<font color='#5555FF'>&amp;</font> arg
    <font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font><font color='#BB00BB'>mxIsStruct</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
        <b>{</b>
            std::ostringstream sout;
            sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> must be a struct</font>";
            <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        <b>}</b>

        arg.<font color='#BB00BB'>set_struct_handle</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>;
    <b>}</b>


    <font color='#0000FF'><u>void</u></font> <b><a name='validate_and_populate_arg'></a>validate_and_populate_arg</b><font face='Lucida Console'>(</font>
        <font color='#0000FF'><u>long</u></font> arg_idx,
        <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs,
        std::string<font color='#5555FF'>&amp;</font> arg
    <font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font><font color='#BB00BB'>mxIsChar</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
        <b>{</b>
            std::ostringstream sout;
            sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> must be a char string</font>";
            <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        <b>}</b>

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> nr <font color='#5555FF'>=</font> <font color='#BB00BB'>mxGetM</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> nc <font color='#5555FF'>=</font> <font color='#BB00BB'>mxGetN</font><font face='Lucida Console'>(</font>prhs<font face='Lucida Console'>)</font>;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> size <font color='#5555FF'>=</font> nr<font color='#5555FF'>*</font>nc;
        arg.<font color='#BB00BB'>resize</font><font face='Lucida Console'>(</font>size<font color='#5555FF'>+</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>;
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#BB00BB'>mxGetString</font><font face='Lucida Console'>(</font>prhs, <font color='#5555FF'>&amp;</font>arg[<font color='#979000'>0</font>], arg.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
        <b>{</b>
            std::ostringstream sout;
            sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> argument </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> arg_idx<font color='#5555FF'>+</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> encountered an error while calling mxGetString()</font>";
            <font color='#0000FF'>throw</font> <font color='#BB00BB'>invalid_args_exception</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        <b>}</b>
        arg.<font color='#BB00BB'>resize</font><font face='Lucida Console'>(</font>size<font face='Lucida Console'>)</font>;
    <b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> EXP<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>typename</font> dlib::enable_if<font color='#5555FF'>&lt;</font>is_same_type<font color='#5555FF'>&lt;</font>dlib::rgb_pixel,<font color='#0000FF'>typename</font> EXP::type<font color='#5555FF'>&gt;</font> <font color='#5555FF'>&gt;</font>::type <b><a name='assign_image_to_matlab'></a>assign_image_to_matlab</b> <font face='Lucida Console'>(</font>
        dlib::uint8<font color='#5555FF'>*</font> mat,
        <font color='#0000FF'>const</font> matrix_exp<font color='#5555FF'>&lt;</font>EXP<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> item
    <font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> c <font color='#5555FF'>=</font> <font color='#979000'>0</font>; c <font color='#5555FF'>&lt;</font> item.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>c<font face='Lucida Console'>)</font>
            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> r <font color='#5555FF'>=</font> <font color='#979000'>0</font>; r <font color='#5555FF'>&lt;</font> item.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>r<font face='Lucida Console'>)</font>
                <font color='#5555FF'>*</font>mat<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>=</font> <font color='#BB00BB'>item</font><font face='Lucida Console'>(</font>r,c<font face='Lucida Console'>)</font>.red;
        <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> c <font color='#5555FF'>=</font> <font color='#979000'>0</font>; c <font color='#5555FF'>&lt;</font> item.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>c<font face='Lucida Console'>)</font>
            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> r <font color='#5555FF'>=</font> <font color='#979000'>0</font>; r <font color='#5555FF'>&lt;</font> item.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>r<font face='Lucida Console'>)</font>
                <font color='#5555FF'>*</font>mat<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>=</font> <font color='#BB00BB'>item</font><font face='Lucida Console'>(</font>r,c<font face='Lucida Console'>)</font>.green;
        <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> c <font color='#5555FF'>=</font> <font color='#979000'>0</font>; c <font color='#5555FF'>&lt;</font> item.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>c<font face='Lucida Console'>)</font>
            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> r <font color='#5555FF'>=</font> <font color='#979000'>0</font>; r <font color='#5555FF'>&lt;</font> item.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>r<font face='Lucida Console'>)</font>
                <font color='#5555FF'>*</font>mat<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>=</font> <font color='#BB00BB'>item</font><font face='Lucida Console'>(</font>r,c<font face='Lucida Console'>)</font>.blue;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> EXP<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>typename</font> disable_if<font color='#5555FF'>&lt;</font>is_same_type<font color='#5555FF'>&lt;</font>dlib::rgb_pixel,<font color='#0000FF'>typename</font> EXP::type<font color='#5555FF'>&gt;</font> <font color='#5555FF'>&gt;</font>::type <b><a name='assign_image_to_matlab'></a>assign_image_to_matlab</b> <font face='Lucida Console'>(</font>
        T<font color='#5555FF'>*</font> mat,
        <font color='#0000FF'>const</font> matrix_exp<font color='#5555FF'>&lt;</font>EXP<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> 
    <font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#BB00BB'>mexErrMsgIdAndTxt</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>mex_function:validate_and_populate_arg</font>",
                          "<font color='#CC0000'>mex_function uses unsupported output image argument type</font>"<font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>typename</font> dlib::enable_if<font color='#5555FF'>&lt;</font>is_matrix<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font> <font color='#5555FF'>&gt;</font>::type <b><a name='assign_to_matlab'></a>assign_to_matlab</b><font face='Lucida Console'>(</font>
        mxArray<font color='#5555FF'>*</font><font color='#5555FF'>&amp;</font> plhs,
        <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> item
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> T::type type;

        type<font color='#5555FF'>*</font> mat <font color='#5555FF'>=</font> <font color='#979000'>0</font>;

        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>double</u></font>, type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>
        <b>{</b>
            plhs <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateDoubleMatrix</font><font face='Lucida Console'>(</font>item.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                        item.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                        mxREAL<font face='Lucida Console'>)</font>;

            mat <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font>type<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetPr</font><font face='Lucida Console'>(</font>plhs<font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>float</u></font>, type<font color='#5555FF'>&gt;</font>::value <font face='Lucida Console'>)</font>
        <b>{</b>
            plhs <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateNumericMatrix</font><font face='Lucida Console'>(</font>item.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         item.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         mxSINGLE_CLASS,
                                         mxREAL<font face='Lucida Console'>)</font>;

            mat <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font>type<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>plhs<font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>bool</u></font>, type<font color='#5555FF'>&gt;</font>::value <font face='Lucida Console'>)</font>
        <b>{</b>
            plhs <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateLogicalMatrix</font><font face='Lucida Console'>(</font>item.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         item.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;

            mat <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font>type<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>plhs<font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>dlib::uint8, type<font color='#5555FF'>&gt;</font>::value <font face='Lucida Console'>)</font>
        <b>{</b>
            plhs <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateNumericMatrix</font><font face='Lucida Console'>(</font>item.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         item.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         mxUINT8_CLASS,
                                         mxREAL<font face='Lucida Console'>)</font>;

            mat <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font>type<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>plhs<font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>dlib::int8, type<font color='#5555FF'>&gt;</font>::value <font face='Lucida Console'>)</font>
        <b>{</b>
            plhs <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateNumericMatrix</font><font face='Lucida Console'>(</font>item.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         item.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         mxINT8_CLASS,
                                         mxREAL<font face='Lucida Console'>)</font>;

            mat <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font>type<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>plhs<font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>dlib::int16, type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font>
                 <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>short</u></font>,type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>short</u></font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font>dlib::int16<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
        <b>{</b>
            plhs <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateNumericMatrix</font><font face='Lucida Console'>(</font>item.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         item.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         mxINT16_CLASS,
                                         mxREAL<font face='Lucida Console'>)</font>;

            mat <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font>type<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>plhs<font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>dlib::uint16, type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font>
                 <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>short</u></font>,type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>short</u></font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font>dlib::uint16<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
        <b>{</b>
            plhs <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateNumericMatrix</font><font face='Lucida Console'>(</font>item.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         item.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         mxUINT16_CLASS,
                                         mxREAL<font face='Lucida Console'>)</font>;

            mat <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font>type<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>plhs<font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>dlib::int32, type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font>
                 <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>long</u></font>,type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font>dlib::int32<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
        <b>{</b>
            plhs <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateNumericMatrix</font><font face='Lucida Console'>(</font>item.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         item.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         mxINT32_CLASS,
                                         mxREAL<font face='Lucida Console'>)</font>;

            mat <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font>type<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>plhs<font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>dlib::uint32, type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font>
                 <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font>,type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font>dlib::uint32<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
        <b>{</b>
            plhs <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateNumericMatrix</font><font face='Lucida Console'>(</font>item.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         item.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         mxUINT32_CLASS,
                                         mxREAL<font face='Lucida Console'>)</font>;

            mat <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font>type<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>plhs<font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>dlib::uint64, type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font>
                 <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font>,type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font>dlib::uint64<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
        <b>{</b>
            plhs <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateNumericMatrix</font><font face='Lucida Console'>(</font>item.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         item.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         mxUINT64_CLASS,
                                         mxREAL<font face='Lucida Console'>)</font>;

            mat <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font>type<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>plhs<font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>dlib::int64, type<font color='#5555FF'>&gt;</font>::value  <font color='#5555FF'>|</font><font color='#5555FF'>|</font> 
                 <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>long</u></font>,type<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font>dlib::int64<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
        <b>{</b>
            plhs <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateNumericMatrix</font><font face='Lucida Console'>(</font>item.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         item.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         mxINT64_CLASS,
                                         mxREAL<font face='Lucida Console'>)</font>;

            mat <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font>type<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>plhs<font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_same_type<font color='#5555FF'>&lt;</font>dlib::rgb_pixel, type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>
        <b>{</b>
            mwSize dims[<font color='#979000'>3</font>] <font color='#5555FF'>=</font> <b>{</b><font face='Lucida Console'>(</font>mwSize<font face='Lucida Console'>)</font>item.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>, <font face='Lucida Console'>(</font>mwSize<font face='Lucida Console'>)</font>item.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>, <font color='#979000'>3</font><b>}</b>;
            plhs <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateNumericArray</font><font face='Lucida Console'>(</font><font color='#979000'>3</font>, dims, mxUINT8_CLASS, mxREAL<font face='Lucida Console'>)</font>;

            <font color='#BB00BB'>assign_image_to_matlab</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>dlib::uint8<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>plhs<font face='Lucida Console'>)</font>, item<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>return</font>;
        <b>}</b>
        <font color='#0000FF'>else</font>
        <b>{</b>
            <font color='#BB00BB'>mexErrMsgIdAndTxt</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>mex_function:validate_and_populate_arg</font>",
                              "<font color='#CC0000'>mex_function uses unsupported output argument type</font>"<font face='Lucida Console'>)</font>;
        <b>}</b>


        const_temp_matrix<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font> <font color='#BB00BB'>m</font><font face='Lucida Console'>(</font>item<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>long</u></font> c <font color='#5555FF'>=</font> <font color='#979000'>0</font>; c <font color='#5555FF'>&lt;</font> m.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>c<font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font> <font color='#0000FF'><u>long</u></font> r <font color='#5555FF'>=</font> <font color='#979000'>0</font>; r <font color='#5555FF'>&lt;</font> m.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>r<font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#5555FF'>*</font>mat<font color='#5555FF'>+</font><font color='#5555FF'>+</font> <font color='#5555FF'>=</font> <font color='#BB00BB'>m</font><font face='Lucida Console'>(</font>r,c<font face='Lucida Console'>)</font>;
            <b>}</b>
        <b>}</b>
    <b>}</b>

    <font color='#0000FF'><u>void</u></font> <b><a name='assign_to_matlab'></a>assign_to_matlab</b><font face='Lucida Console'>(</font>
        mxArray<font color='#5555FF'>*</font><font color='#5555FF'>&amp;</font> plhs,
        matrix_colmajor<font color='#5555FF'>&amp;</font> item
    <font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#0000FF'>if</font><font face='Lucida Console'>(</font>item.<font color='#BB00BB'>_private_is_owned_by_matlab</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#009900'>// Don't need to do a copy if it's this kind of matrix since we can just
</font>            <font color='#009900'>// pull the underlying mxArray out directly and thus avoid a copy.
</font>            plhs <font color='#5555FF'>=</font> item.<font color='#BB00BB'>_private_release_mxArray</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
            <font color='#009900'>// If there isn't anything there because the matrix is empty then set it to an
</font>            <font color='#009900'>// empty matrix.
</font>            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font>plhs<font face='Lucida Console'>)</font>
                plhs <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateDoubleMatrix</font><font face='Lucida Console'>(</font>item.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                            item.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                            mxREAL<font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>else</font>
        <b>{</b>
            plhs <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateDoubleMatrix</font><font face='Lucida Console'>(</font>item.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                        item.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                        mxREAL<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>item.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
                <font color='#BB00BB'>memcpy</font><font face='Lucida Console'>(</font><font color='#BB00BB'>mxGetPr</font><font face='Lucida Console'>(</font>plhs<font face='Lucida Console'>)</font>, <font color='#5555FF'>&amp;</font><font color='#BB00BB'>item</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,<font color='#979000'>0</font><font face='Lucida Console'>)</font>, item.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>*</font><font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>double</u></font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        <b>}</b>
    <b>}</b>

    <font color='#0000FF'><u>void</u></font> <b><a name='assign_to_matlab'></a>assign_to_matlab</b><font face='Lucida Console'>(</font>
        mxArray<font color='#5555FF'>*</font><font color='#5555FF'>&amp;</font> plhs,
        fmatrix_colmajor<font color='#5555FF'>&amp;</font> item
    <font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#0000FF'>if</font><font face='Lucida Console'>(</font>item.<font color='#BB00BB'>_private_is_owned_by_matlab</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#009900'>// Don't need to do a copy if it's this kind of matrix since we can just
</font>            <font color='#009900'>// pull the underlying mxArray out directly and thus avoid a copy.
</font>            plhs <font color='#5555FF'>=</font> item.<font color='#BB00BB'>_private_release_mxArray</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
            <font color='#009900'>// If there isn't anything there because the matrix is empty then set it to an
</font>            <font color='#009900'>// empty matrix.
</font>            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font>plhs<font face='Lucida Console'>)</font>
                plhs <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateNumericMatrix</font><font face='Lucida Console'>(</font>item.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                            item.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                            mxSINGLE_CLASS,
                                            mxREAL<font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>else</font>
        <b>{</b>
            plhs <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateNumericMatrix</font><font face='Lucida Console'>(</font>item.<font color='#BB00BB'>nr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         item.<font color='#BB00BB'>nc</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>,
                                         mxSINGLE_CLASS,
                                         mxREAL<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>item.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
                <font color='#BB00BB'>memcpy</font><font face='Lucida Console'>(</font><font color='#BB00BB'>mxGetPr</font><font face='Lucida Console'>(</font>plhs<font face='Lucida Console'>)</font>, <font color='#5555FF'>&amp;</font><font color='#BB00BB'>item</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,<font color='#979000'>0</font><font face='Lucida Console'>)</font>, item.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>*</font><font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font><font color='#0000FF'><u>float</u></font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        <b>}</b>
    <b>}</b>

    <font color='#0000FF'><u>void</u></font> <b><a name='assign_to_matlab'></a>assign_to_matlab</b><font face='Lucida Console'>(</font>
        mxArray<font color='#5555FF'>*</font><font color='#5555FF'>&amp;</font> plhs,
        matlab_struct<font color='#5555FF'>&amp;</font> item
    <font face='Lucida Console'>)</font>
    <b>{</b>
        plhs <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font>mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>item.<font color='#BB00BB'>release_struct_to_matlab</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'><u>void</u></font> <b><a name='assign_to_matlab'></a>assign_to_matlab</b><font face='Lucida Console'>(</font>
        mxArray<font color='#5555FF'>*</font><font color='#5555FF'>&amp;</font> plhs,
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> item
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        plhs <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateString</font><font face='Lucida Console'>(</font>item.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> MM<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='assign_to_matlab'></a>assign_to_matlab</b><font face='Lucida Console'>(</font>
        mxArray<font color='#5555FF'>*</font><font color='#5555FF'>&amp;</font> plhs,
        <font color='#0000FF'>const</font> array2d<font color='#5555FF'>&lt;</font>T,MM<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> item
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs,<font color='#BB00BB'>array_to_matrix</font><font face='Lucida Console'>(</font>item<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>typename</font> dlib::disable_if_c<font color='#5555FF'>&lt;</font>is_matrix<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font> is_array_type<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value <font color='#5555FF'>|</font><font color='#5555FF'>|</font> 
                                is_same_type<font color='#5555FF'>&lt;</font>T,function_handle<font color='#5555FF'>&gt;</font>::value<font color='#5555FF'>&gt;</font>::type <b><a name='assign_to_matlab'></a>assign_to_matlab</b><font face='Lucida Console'>(</font>
        mxArray<font color='#5555FF'>*</font><font color='#5555FF'>&amp;</font> plhs,
        <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> item
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        plhs <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateDoubleScalar</font><font face='Lucida Console'>(</font>item<font face='Lucida Console'>)</font>;
    <b>}</b>


    <font color='#0000FF'><u>void</u></font> <b><a name='assign_to_matlab'></a>assign_to_matlab</b> <font face='Lucida Console'>(</font>
        mxArray<font color='#5555FF'>*</font><font color='#5555FF'>&amp;</font> plhs,
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>char</u></font><font color='#5555FF'>*</font> str
    <font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs, std::<font color='#BB00BB'>string</font><font face='Lucida Console'>(</font>str<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'><u>void</u></font> <b><a name='assign_to_matlab'></a>assign_to_matlab</b><font face='Lucida Console'>(</font>
        mxArray<font color='#5555FF'>*</font><font color='#5555FF'>&amp;</font> plhs,
        <font color='#0000FF'>const</font> function_handle<font color='#5555FF'>&amp;</font> h
    <font face='Lucida Console'>)</font>
    <b>{</b>
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>typename</font> dlib::enable_if<font color='#5555FF'>&lt;</font>is_array_type<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font> <font color='#5555FF'>&gt;</font>::type <b><a name='assign_to_matlab'></a>assign_to_matlab</b><font face='Lucida Console'>(</font>
        mxArray<font color='#5555FF'>*</font><font color='#5555FF'>&amp;</font> plhs,
        <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> item
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        mwSize dims[<font color='#979000'>1</font>] <font color='#5555FF'>=</font> <b>{</b>item.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><b>}</b>;
        plhs <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateCellArray</font><font face='Lucida Console'>(</font><font color='#979000'>1</font>,dims<font face='Lucida Console'>)</font>;
        <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>; i <font color='#5555FF'>&lt;</font> item.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
        <b>{</b>
            mxArray<font color='#5555FF'>*</font> next <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>next, item[i]<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mxSetCell</font><font face='Lucida Console'>(</font>plhs, i, next<font face='Lucida Console'>)</font>;
        <b>}</b>
    <b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='mark_owned_by_matlab'></a>mark_owned_by_matlab</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font><font face='Lucida Console'>)</font><b>{</b><b>}</b>

    <font color='#0000FF'><u>void</u></font> <b><a name='mark_owned_by_matlab'></a>mark_owned_by_matlab</b><font face='Lucida Console'>(</font>matrix_colmajor<font color='#5555FF'>&amp;</font> item<font face='Lucida Console'>)</font> <b>{</b> item.<font color='#BB00BB'>_private_mark_owned_by_matlab</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>
    <font color='#0000FF'><u>void</u></font> <b><a name='mark_owned_by_matlab'></a>mark_owned_by_matlab</b><font face='Lucida Console'>(</font>fmatrix_colmajor<font color='#5555FF'>&amp;</font> item<font face='Lucida Console'>)</font> <b>{</b> item.<font color='#BB00BB'>_private_mark_owned_by_matlab</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> num_args
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> call_mex_function_helper;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>0</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> , mxArray <font color='#5555FF'>*</font><font color='#5555FF'>*</font>,
            <font color='#0000FF'><u>int</u></font> , <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font><font color='#5555FF'>*</font>
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
        <b>}</b>
    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>1</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
            <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type arg1_type;

            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::type A1;

            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;

            <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_1;

            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;

            i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
        <b>}</b>
    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>2</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
            <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type arg1_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type arg2_type;

            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::type A1;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::type A2;

            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A2<font face='Lucida Console'>)</font>;

            <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_1;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_2;

            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font>A1,A2<font face='Lucida Console'>)</font>;

            i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
        <b>}</b>
    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>3</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
            <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type arg1_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type arg2_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type arg3_type;

            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::type A1;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::type A2;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::type A3;

            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A2<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A3<font face='Lucida Console'>)</font>;

            <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_1;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_2;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_3;

            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font>A1,A2,A3<font face='Lucida Console'>)</font>;

            i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
        <b>}</b>
    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>4</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
            <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type arg1_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type arg2_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type arg3_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg4_type arg4_type;

            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::type A1;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::type A2;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::type A3;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::type A4;

            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A2<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A3<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A4<font face='Lucida Console'>)</font>;

            <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_1;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_2;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_3;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_4;

            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font>A1,A2,A3,A4<font face='Lucida Console'>)</font>;


            i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
        <b>}</b>
    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>5</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
            <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type arg1_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type arg2_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type arg3_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg4_type arg4_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg5_type arg5_type;

            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::type A1;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::type A2;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::type A3;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::type A4;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::type A5;

            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A2<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A3<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A4<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A5<font face='Lucida Console'>)</font>;

            <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_1;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_2;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_3;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_4;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_5;

            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font>A1,A2,A3,A4,A5<font face='Lucida Console'>)</font>;


            i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
        <b>}</b>
    <b>}</b>;


    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>6</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
            <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type arg1_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type arg2_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type arg3_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg4_type arg4_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg5_type arg5_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg6_type arg6_type;

            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::type A1;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::type A2;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::type A3;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::type A4;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::type A5;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::type A6;

            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A2<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A3<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A4<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A5<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A6<font face='Lucida Console'>)</font>;

            <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_1;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_2;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_3;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_4;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_5;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_6;

            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font>A1,A2,A3,A4,A5,A6<font face='Lucida Console'>)</font>;


            i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
        <b>}</b>
    <b>}</b>;


    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>7</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
            <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type arg1_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type arg2_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type arg3_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg4_type arg4_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg5_type arg5_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg6_type arg6_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg7_type arg7_type;

            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::type A1;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::type A2;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::type A3;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::type A4;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::type A5;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::type A6;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::type A7;

            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A2<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A3<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A4<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A5<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A6<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A7<font face='Lucida Console'>)</font>;

            <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_1;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_2;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_3;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_4;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_5;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_6;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_7;

            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font>A1,A2,A3,A4,A5,A6,A7<font face='Lucida Console'>)</font>;


            i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
        <b>}</b>
    <b>}</b>;


    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>8</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
            <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type arg1_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type arg2_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type arg3_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg4_type arg4_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg5_type arg5_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg6_type arg6_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg7_type arg7_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg8_type arg8_type;

            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::type A1;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::type A2;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::type A3;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::type A4;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::type A5;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::type A6;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::type A7;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::type A8;

            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A2<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A3<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A4<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A5<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A6<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A7<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A8<font face='Lucida Console'>)</font>;

            <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_1;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_2;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_3;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_4;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_5;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_6;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_7;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_8;

            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font>A1,A2,A3,A4,A5,A6,A7,A8<font face='Lucida Console'>)</font>;


            i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
        <b>}</b>
    <b>}</b>;


    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>9</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
            <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type arg1_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type arg2_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type arg3_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg4_type arg4_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg5_type arg5_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg6_type arg6_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg7_type arg7_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg8_type arg8_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg9_type arg9_type;

            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::type A1;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::type A2;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::type A3;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::type A4;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::type A5;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::type A6;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::type A7;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::type A8;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::type A9;

            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A2<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A3<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A4<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A5<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A6<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A7<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A8<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A9<font face='Lucida Console'>)</font>;

            <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_1;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_2;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_3;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_4;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_5;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_6;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_7;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_8;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_9;

            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font>A1,A2,A3,A4,A5,A6,A7,A8,A9<font face='Lucida Console'>)</font>;


            i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
        <b>}</b>
    <b>}</b>;



    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>10</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
            <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type arg1_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type arg2_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type arg3_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg4_type arg4_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg5_type arg5_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg6_type arg6_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg7_type arg7_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg8_type arg8_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg9_type arg9_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg10_type arg10_type;

            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::type A1;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::type A2;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::type A3;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::type A4;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::type A5;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::type A6;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::type A7;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::type A8;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::type A9;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::type A10;

            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A2<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A3<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A4<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A5<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A6<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A7<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A8<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A9<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A10<font face='Lucida Console'>)</font>;

            <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_1;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_2;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_3;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_4;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_5;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_6;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_7;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_8;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_9;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_10;

            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font>A1,A2,A3,A4,A5,A6,A7,A8,A9,A10<font face='Lucida Console'>)</font>;


            i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
        <b>}</b>
    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>11</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
            <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type arg1_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type arg2_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type arg3_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg4_type arg4_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg5_type arg5_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg6_type arg6_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg7_type arg7_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg8_type arg8_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg9_type arg9_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg10_type arg10_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg11_type arg11_type;

            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::type A1;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::type A2;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::type A3;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::type A4;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::type A5;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::type A6;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::type A7;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::type A8;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::type A9;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::type A10;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::type A11;

            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A2<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A3<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A4<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A5<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A6<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A7<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A8<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A9<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A10<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A11<font face='Lucida Console'>)</font>;

            <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_1;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_2;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_3;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_4;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_5;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_6;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_7;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_8;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_9;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_10;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A11<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_11;

            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font>A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11<font face='Lucida Console'>)</font>;


            i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A11<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
        <b>}</b>
    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>12</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
            <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type arg1_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type arg2_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type arg3_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg4_type arg4_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg5_type arg5_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg6_type arg6_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg7_type arg7_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg8_type arg8_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg9_type arg9_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg10_type arg10_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg11_type arg11_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg12_type arg12_type;

            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::type A1;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::type A2;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::type A3;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::type A4;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::type A5;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::type A6;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::type A7;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::type A8;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::type A9;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::type A10;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::type A11;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::type A12;

            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A2<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A3<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A4<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A5<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A6<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A7<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A8<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A9<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A10<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A11<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A12<font face='Lucida Console'>)</font>;

            <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_1;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_2;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_3;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_4;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_5;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_6;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_7;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_8;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_9;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_10;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A11<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_11;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A12<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_12;

            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font>A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12<font face='Lucida Console'>)</font>;


            i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A11<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A12<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
        <b>}</b>
    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>13</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
            <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type arg1_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type arg2_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type arg3_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg4_type arg4_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg5_type arg5_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg6_type arg6_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg7_type arg7_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg8_type arg8_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg9_type arg9_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg10_type arg10_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg11_type arg11_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg12_type arg12_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg13_type arg13_type;

            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::type A1;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::type A2;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::type A3;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::type A4;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::type A5;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::type A6;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::type A7;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::type A8;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::type A9;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::type A10;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::type A11;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::type A12;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::type A13;

            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A2<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A3<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A4<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A5<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A6<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A7<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A8<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A9<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A10<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A11<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A12<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A13<font face='Lucida Console'>)</font>;

            <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_1;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_2;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_3;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_4;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_5;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_6;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_7;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_8;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_9;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_10;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A11<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_11;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A12<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_12;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A13<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_13;

            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font>A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13<font face='Lucida Console'>)</font>;


            i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A11<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A12<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A13<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
        <b>}</b>
    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>14</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
            <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type arg1_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type arg2_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type arg3_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg4_type arg4_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg5_type arg5_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg6_type arg6_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg7_type arg7_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg8_type arg8_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg9_type arg9_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg10_type arg10_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg11_type arg11_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg12_type arg12_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg13_type arg13_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg14_type arg14_type;

            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::type A1;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::type A2;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::type A3;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::type A4;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::type A5;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::type A6;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::type A7;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::type A8;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::type A9;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::type A10;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::type A11;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::type A12;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::type A13;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::type A14;

            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A2<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A3<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A4<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A5<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A6<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A7<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A8<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A9<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A10<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A11<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A12<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A13<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A14<font face='Lucida Console'>)</font>;

            <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_1;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_2;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_3;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_4;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_5;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_6;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_7;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_8;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_9;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_10;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A11<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_11;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A12<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_12;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A13<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_13;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A14<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_14;

            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font>A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14<font face='Lucida Console'>)</font>;


            i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A11<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A12<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A13<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A14<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
        <b>}</b>
    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>15</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
            <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type arg1_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type arg2_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type arg3_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg4_type arg4_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg5_type arg5_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg6_type arg6_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg7_type arg7_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg8_type arg8_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg9_type arg9_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg10_type arg10_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg11_type arg11_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg12_type arg12_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg13_type arg13_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg14_type arg14_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg15_type arg15_type;

            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::type A1;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::type A2;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::type A3;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::type A4;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::type A5;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::type A6;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::type A7;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::type A8;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::type A9;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::type A10;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::type A11;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::type A12;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::type A13;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::type A14;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg15_type<font color='#5555FF'>&gt;</font>::type A15;

            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A2<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A3<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A4<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A5<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A6<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A7<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A8<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A9<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A10<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A11<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A12<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A13<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A14<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A15<font face='Lucida Console'>)</font>;

            <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_1;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_2;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_3;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_4;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_5;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_6;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_7;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_8;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_9;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_10;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A11<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_11;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A12<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_12;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A13<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_13;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A14<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_14;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg15_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A15<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_15;

            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font>A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15<font face='Lucida Console'>)</font>;


            i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A11<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A12<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A13<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A14<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg15_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A15<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
        <b>}</b>
    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>16</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
            <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type arg1_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type arg2_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type arg3_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg4_type arg4_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg5_type arg5_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg6_type arg6_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg7_type arg7_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg8_type arg8_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg9_type arg9_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg10_type arg10_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg11_type arg11_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg12_type arg12_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg13_type arg13_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg14_type arg14_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg15_type arg15_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg16_type arg16_type;

            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::type A1;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::type A2;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::type A3;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::type A4;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::type A5;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::type A6;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::type A7;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::type A8;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::type A9;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::type A10;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::type A11;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::type A12;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::type A13;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::type A14;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg15_type<font color='#5555FF'>&gt;</font>::type A15;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg16_type<font color='#5555FF'>&gt;</font>::type A16;

            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A2<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A3<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A4<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A5<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A6<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A7<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A8<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A9<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A10<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A11<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A12<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A13<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A14<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A15<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A16<font face='Lucida Console'>)</font>;

            <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_1;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_2;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_3;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_4;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_5;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_6;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_7;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_8;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_9;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_10;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A11<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_11;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A12<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_12;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A13<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_13;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A14<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_14;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg15_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A15<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_15;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg16_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A16<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_16;

            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font>A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16<font face='Lucida Console'>)</font>;


            i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A11<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A12<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A13<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A14<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg15_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A15<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg16_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A16<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
        <b>}</b>
    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>17</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
            <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type arg1_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type arg2_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type arg3_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg4_type arg4_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg5_type arg5_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg6_type arg6_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg7_type arg7_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg8_type arg8_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg9_type arg9_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg10_type arg10_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg11_type arg11_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg12_type arg12_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg13_type arg13_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg14_type arg14_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg15_type arg15_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg16_type arg16_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg17_type arg17_type;

            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::type A1;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::type A2;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::type A3;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::type A4;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::type A5;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::type A6;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::type A7;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::type A8;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::type A9;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::type A10;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::type A11;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::type A12;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::type A13;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::type A14;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg15_type<font color='#5555FF'>&gt;</font>::type A15;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg16_type<font color='#5555FF'>&gt;</font>::type A16;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg17_type<font color='#5555FF'>&gt;</font>::type A17;

            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A2<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A3<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A4<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A5<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A6<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A7<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A8<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A9<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A10<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A11<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A12<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A13<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A14<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A15<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A16<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A17<font face='Lucida Console'>)</font>;

            <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_1;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_2;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_3;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_4;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_5;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_6;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_7;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_8;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_9;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_10;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A11<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_11;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A12<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_12;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A13<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_13;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A14<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_14;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg15_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A15<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_15;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg16_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A16<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_16;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg17_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A17<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_17;

            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font>A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17<font face='Lucida Console'>)</font>;


            i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A11<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A12<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A13<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A14<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg15_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A15<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg16_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A16<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg17_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A17<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
        <b>}</b>
    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>18</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
            <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type arg1_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type arg2_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type arg3_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg4_type arg4_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg5_type arg5_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg6_type arg6_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg7_type arg7_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg8_type arg8_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg9_type arg9_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg10_type arg10_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg11_type arg11_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg12_type arg12_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg13_type arg13_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg14_type arg14_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg15_type arg15_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg16_type arg16_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg17_type arg17_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg18_type arg18_type;

            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::type A1;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::type A2;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::type A3;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::type A4;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::type A5;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::type A6;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::type A7;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::type A8;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::type A9;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::type A10;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::type A11;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::type A12;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::type A13;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::type A14;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg15_type<font color='#5555FF'>&gt;</font>::type A15;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg16_type<font color='#5555FF'>&gt;</font>::type A16;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg17_type<font color='#5555FF'>&gt;</font>::type A17;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg18_type<font color='#5555FF'>&gt;</font>::type A18;

            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A2<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A3<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A4<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A5<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A6<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A7<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A8<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A9<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A10<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A11<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A12<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A13<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A14<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A15<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A16<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A17<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A18<font face='Lucida Console'>)</font>;

            <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_1;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_2;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_3;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_4;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_5;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_6;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_7;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_8;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_9;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_10;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A11<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_11;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A12<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_12;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A13<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_13;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A14<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_14;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg15_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A15<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_15;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg16_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A16<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_16;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg17_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A17<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_17;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg18_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A18<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_18;

            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font>A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18<font face='Lucida Console'>)</font>;


            i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A11<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A12<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A13<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A14<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg15_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A15<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg16_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A16<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg17_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A17<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg18_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A18<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
        <b>}</b>
    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>19</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
            <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type arg1_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type arg2_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type arg3_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg4_type arg4_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg5_type arg5_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg6_type arg6_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg7_type arg7_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg8_type arg8_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg9_type arg9_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg10_type arg10_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg11_type arg11_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg12_type arg12_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg13_type arg13_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg14_type arg14_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg15_type arg15_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg16_type arg16_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg17_type arg17_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg18_type arg18_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg19_type arg19_type;

            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::type A1;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::type A2;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::type A3;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::type A4;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::type A5;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::type A6;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::type A7;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::type A8;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::type A9;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::type A10;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::type A11;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::type A12;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::type A13;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::type A14;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg15_type<font color='#5555FF'>&gt;</font>::type A15;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg16_type<font color='#5555FF'>&gt;</font>::type A16;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg17_type<font color='#5555FF'>&gt;</font>::type A17;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg18_type<font color='#5555FF'>&gt;</font>::type A18;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg19_type<font color='#5555FF'>&gt;</font>::type A19;

            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A2<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A3<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A4<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A5<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A6<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A7<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A8<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A9<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A10<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A11<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A12<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A13<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A14<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A15<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A16<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A17<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A18<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A19<font face='Lucida Console'>)</font>;

            <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_1;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_2;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_3;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_4;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_5;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_6;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_7;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_8;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_9;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_10;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A11<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_11;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A12<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_12;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A13<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_13;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A14<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_14;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg15_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A15<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_15;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg16_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A16<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_16;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg17_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A17<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_17;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg18_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A18<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_18;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg19_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A19<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_19;

            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font>A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19<font face='Lucida Console'>)</font>;


            i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A11<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A12<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A13<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A14<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg15_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A15<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg16_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A16<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg17_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A17<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg18_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A18<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg19_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A19<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
        <b>}</b>
    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='call_mex_function_helper'></a>call_mex_function_helper</b><font color='#5555FF'>&lt;</font><font color='#979000'>20</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'><u>void</u></font> <b><a name='callit'></a>callit</b><font face='Lucida Console'>(</font>
            <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
            <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
            <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type arg1_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type arg2_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type arg3_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg4_type arg4_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg5_type arg5_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg6_type arg6_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg7_type arg7_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg8_type arg8_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg9_type arg9_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg10_type arg10_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg11_type arg11_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg12_type arg12_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg13_type arg13_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg14_type arg14_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg15_type arg15_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg16_type arg16_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg17_type arg17_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg18_type arg18_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg19_type arg19_type;
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg20_type arg20_type;

            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::type A1;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::type A2;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::type A3;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::type A4;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::type A5;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::type A6;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::type A7;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::type A8;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::type A9;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::type A10;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::type A11;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::type A12;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::type A13;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::type A14;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg15_type<font color='#5555FF'>&gt;</font>::type A15;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg16_type<font color='#5555FF'>&gt;</font>::type A16;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg17_type<font color='#5555FF'>&gt;</font>::type A17;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg18_type<font color='#5555FF'>&gt;</font>::type A18;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg19_type<font color='#5555FF'>&gt;</font>::type A19;
            <font color='#0000FF'>typename</font> basic_type<font color='#5555FF'>&lt;</font>arg20_type<font color='#5555FF'>&gt;</font>::type A20;

            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A1<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A2<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A3<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A4<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A5<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A6<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A7<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A8<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A9<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A10<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A11<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A12<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A13<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A14<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A15<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A16<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A17<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A18<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A19<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mark_owned_by_matlab</font><font face='Lucida Console'>(</font>A20<font face='Lucida Console'>)</font>;

            <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_1;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_2;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_3;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_4;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_5;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_6;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_7;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_8;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_9;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_10;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A11<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_11;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A12<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_12;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A13<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_13;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A14<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_14;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg15_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A15<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_15;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg16_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A16<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_16;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg17_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A17<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_17;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg18_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A18<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_18;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg19_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A19<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_19;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> is_input_type<font color='#5555FF'>&lt;</font>arg20_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,prhs[i],A20<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b> ELSE_ASSIGN_ARG_20;

            <font color='#BB00BB'>f</font><font face='Lucida Console'>(</font>A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13,A14,A15,A16,A17,A18,A19,A20<font face='Lucida Console'>)</font>;


            i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A1<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A2<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A3<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A4<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A5<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A6<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A7<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A8<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A9<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A10<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A11<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg12_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A12<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg13_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A13<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg14_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A14<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg15_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A15<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg16_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A16<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg17_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A17<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg18_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A18<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg19_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A19<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>is_output_type<font color='#5555FF'>&lt;</font>arg20_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font> <b>{</b><font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>plhs[i],A20<font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;<b>}</b>
        <b>}</b>
    <b>}</b>;

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> funct
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_mex_function'></a>call_mex_function</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> f,
        <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
        <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]
    <font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> expected_nrhs <font color='#5555FF'>=</font> funct_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::num_inputs;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> expected_nlhs <font color='#5555FF'>=</font> funct_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::num_outputs;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>long</u></font> expected_args <font color='#5555FF'>=</font> expected_nrhs <font color='#5555FF'>+</font> expected_nlhs;

        <font color='#0000FF'><u>long</u></font> defaulted_args <font color='#5555FF'>=</font> <font color='#979000'>0</font>;

        <font color='#0000FF'>#ifdef</font> ARG_1_DEFAULT
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>defaulted_args;
            <font color='#009900'>// You can only set an argument's default value if it is an input argument.
</font>            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg1_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#ifndef</font> ARG_2_DEFAULT
                <font color='#009900'>// You can't define a default for argument 1 if you don't define one for argument 2 also.
</font>                <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>expected_args <font color='#5555FF'>&lt;</font> <font color='#979000'>2</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#endif</font>
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> expected_args<font face='Lucida Console'>)</font>; <font color='#009900'>// You can't define a default for an argument that doesn't exist.
</font>        <font color='#0000FF'>#endif</font>
        <font color='#0000FF'>#ifdef</font> ARG_2_DEFAULT
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>defaulted_args;
            <font color='#009900'>// You can only set an argument's default value if it is an input argument.
</font>            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg2_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#ifndef</font> ARG_3_DEFAULT
                <font color='#009900'>// You can't define a default for argument 2 if you don't define one for argument 3 also.
</font>                <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>expected_args <font color='#5555FF'>&lt;</font> <font color='#979000'>3</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#endif</font>
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>2</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> expected_args<font face='Lucida Console'>)</font>; <font color='#009900'>// You can't define a default for an argument that doesn't exist.
</font>        <font color='#0000FF'>#endif</font>
        <font color='#0000FF'>#ifdef</font> ARG_3_DEFAULT
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>defaulted_args;
            <font color='#009900'>// You can only set an argument's default value if it is an input argument.
</font>            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg3_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#ifndef</font> ARG_4_DEFAULT
                <font color='#009900'>// You can't define a default for argument 3 if you don't define one for argument 4 also.
</font>                <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>expected_args <font color='#5555FF'>&lt;</font> <font color='#979000'>4</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#endif</font>
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>3</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> expected_args<font face='Lucida Console'>)</font>; <font color='#009900'>// You can't define a default for an argument that doesn't exist.
</font>        <font color='#0000FF'>#endif</font>
        <font color='#0000FF'>#ifdef</font> ARG_4_DEFAULT
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>defaulted_args;
            <font color='#009900'>// You can only set an argument's default value if it is an input argument.
</font>            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg4_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#ifndef</font> ARG_5_DEFAULT
                <font color='#009900'>// You can't define a default for argument 4 if you don't define one for argument 5 also.
</font>                <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>expected_args <font color='#5555FF'>&lt;</font> <font color='#979000'>5</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#endif</font>
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>4</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> expected_args<font face='Lucida Console'>)</font>; <font color='#009900'>// You can't define a default for an argument that doesn't exist.
</font>        <font color='#0000FF'>#endif</font>
        <font color='#0000FF'>#ifdef</font> ARG_5_DEFAULT
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>defaulted_args;
            <font color='#009900'>// You can only set an argument's default value if it is an input argument.
</font>            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg5_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#ifndef</font> ARG_6_DEFAULT
                <font color='#009900'>// You can't define a default for argument 5 if you don't define one for argument 6 also.
</font>                <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>expected_args <font color='#5555FF'>&lt;</font> <font color='#979000'>6</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#endif</font>
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>5</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> expected_args<font face='Lucida Console'>)</font>; <font color='#009900'>// You can't define a default for an argument that doesn't exist.
</font>        <font color='#0000FF'>#endif</font>
        <font color='#0000FF'>#ifdef</font> ARG_6_DEFAULT
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>defaulted_args;
            <font color='#009900'>// You can only set an argument's default value if it is an input argument.
</font>            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg6_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#ifndef</font> ARG_7_DEFAULT
                <font color='#009900'>// You can't define a default for argument 6 if you don't define one for argument 7 also.
</font>                <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>expected_args <font color='#5555FF'>&lt;</font> <font color='#979000'>7</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#endif</font>
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>6</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> expected_args<font face='Lucida Console'>)</font>; <font color='#009900'>// You can't define a default for an argument that doesn't exist.
</font>        <font color='#0000FF'>#endif</font>
        <font color='#0000FF'>#ifdef</font> ARG_7_DEFAULT
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>defaulted_args;
            <font color='#009900'>// You can only set an argument's default value if it is an input argument.
</font>            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg7_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#ifndef</font> ARG_8_DEFAULT
                <font color='#009900'>// You can't define a default for argument 7 if you don't define one for argument 8 also.
</font>                <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>expected_args <font color='#5555FF'>&lt;</font> <font color='#979000'>8</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#endif</font>
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>7</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> expected_args<font face='Lucida Console'>)</font>; <font color='#009900'>// You can't define a default for an argument that doesn't exist.
</font>        <font color='#0000FF'>#endif</font>
        <font color='#0000FF'>#ifdef</font> ARG_8_DEFAULT
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>defaulted_args;
            <font color='#009900'>// You can only set an argument's default value if it is an input argument.
</font>            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg8_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#ifndef</font> ARG_9_DEFAULT
                <font color='#009900'>// You can't define a default for argument 8 if you don't define one for argument 9 also.
</font>                <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>expected_args <font color='#5555FF'>&lt;</font> <font color='#979000'>9</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#endif</font>
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>8</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> expected_args<font face='Lucida Console'>)</font>; <font color='#009900'>// You can't define a default for an argument that doesn't exist.
</font>        <font color='#0000FF'>#endif</font>
        <font color='#0000FF'>#ifdef</font> ARG_9_DEFAULT
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>defaulted_args;
            <font color='#009900'>// You can only set an argument's default value if it is an input argument.
</font>            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg9_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#ifndef</font> ARG_10_DEFAULT
                <font color='#009900'>// You can't define a default for argument 9 if you don't define one for argument 10 also.
</font>                <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>expected_args <font color='#5555FF'>&lt;</font> <font color='#979000'>10</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#endif</font>
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>9</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> expected_args<font face='Lucida Console'>)</font>; <font color='#009900'>// You can't define a default for an argument that doesn't exist.
</font>        <font color='#0000FF'>#endif</font>
        <font color='#0000FF'>#ifdef</font> ARG_10_DEFAULT
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>defaulted_args;
            <font color='#009900'>// You can only set an argument's default value if it is an input argument.
</font>            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg10_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#ifndef</font> ARG_11_DEFAULT
                <font color='#009900'>// You can't define a default for argument 10 if you don't define one for argument 11 also.
</font>                <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>expected_args <font color='#5555FF'>&lt;</font> <font color='#979000'>11</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#endif</font>
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>10</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> expected_args<font face='Lucida Console'>)</font>; <font color='#009900'>// You can't define a default for an argument that doesn't exist.
</font>        <font color='#0000FF'>#endif</font>
        <font color='#0000FF'>#ifdef</font> ARG_11_DEFAULT
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>defaulted_args;
            <font color='#009900'>// You can only set an argument's default value if it is an input argument.
</font>            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg11_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#ifndef</font> ARG_12_DEFAULT
                <font color='#009900'>// You can't define a default for argument 11 if you don't define one for argument 12 also.
</font>                <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>expected_args <font color='#5555FF'>&lt;</font> <font color='#979000'>12</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#endif</font>
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>11</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> expected_args<font face='Lucida Console'>)</font>; <font color='#009900'>// You can't define a default for an argument that doesn't exist.
</font>        <font color='#0000FF'>#endif</font>
        <font color='#0000FF'>#ifdef</font> ARG_12_DEFAULT
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>defaulted_args;
            <font color='#009900'>// You can only set an argument's default value if it is an input argument.
</font>            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg12_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#ifndef</font> ARG_13_DEFAULT
                <font color='#009900'>// You can't define a default for argument 12 if you don't define one for argument 13 also.
</font>                <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>expected_args <font color='#5555FF'>&lt;</font> <font color='#979000'>13</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#endif</font>
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>12</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> expected_args<font face='Lucida Console'>)</font>; <font color='#009900'>// You can't define a default for an argument that doesn't exist.
</font>        <font color='#0000FF'>#endif</font>
        <font color='#0000FF'>#ifdef</font> ARG_13_DEFAULT
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>defaulted_args;
            <font color='#009900'>// You can only set an argument's default value if it is an input argument.
</font>            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg13_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#ifndef</font> ARG_14_DEFAULT
                <font color='#009900'>// You can't define a default for argument 13 if you don't define one for argument 14 also.
</font>                <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>expected_args <font color='#5555FF'>&lt;</font> <font color='#979000'>14</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#endif</font>
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>13</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> expected_args<font face='Lucida Console'>)</font>; <font color='#009900'>// You can't define a default for an argument that doesn't exist.
</font>        <font color='#0000FF'>#endif</font>
        <font color='#0000FF'>#ifdef</font> ARG_14_DEFAULT
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>defaulted_args;
            <font color='#009900'>// You can only set an argument's default value if it is an input argument.
</font>            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg14_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#ifndef</font> ARG_15_DEFAULT
                <font color='#009900'>// You can't define a default for argument 14 if you don't define one for argument 15 also.
</font>                <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>expected_args <font color='#5555FF'>&lt;</font> <font color='#979000'>15</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#endif</font>
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>14</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> expected_args<font face='Lucida Console'>)</font>; <font color='#009900'>// You can't define a default for an argument that doesn't exist.
</font>        <font color='#0000FF'>#endif</font>
        <font color='#0000FF'>#ifdef</font> ARG_15_DEFAULT
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>defaulted_args;
            <font color='#009900'>// You can only set an argument's default value if it is an input argument.
</font>            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg15_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#ifndef</font> ARG_16_DEFAULT
                <font color='#009900'>// You can't define a default for argument 15 if you don't define one for argument 16 also.
</font>                <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>expected_args <font color='#5555FF'>&lt;</font> <font color='#979000'>16</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#endif</font>
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>15</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> expected_args<font face='Lucida Console'>)</font>; <font color='#009900'>// You can't define a default for an argument that doesn't exist.
</font>        <font color='#0000FF'>#endif</font>
        <font color='#0000FF'>#ifdef</font> ARG_16_DEFAULT
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>defaulted_args;
            <font color='#009900'>// You can only set an argument's default value if it is an input argument.
</font>            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg16_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#ifndef</font> ARG_17_DEFAULT
                <font color='#009900'>// You can't define a default for argument 16 if you don't define one for argument 17 also.
</font>                <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>expected_args <font color='#5555FF'>&lt;</font> <font color='#979000'>17</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#endif</font>
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>16</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> expected_args<font face='Lucida Console'>)</font>; <font color='#009900'>// You can't define a default for an argument that doesn't exist.
</font>        <font color='#0000FF'>#endif</font>
        <font color='#0000FF'>#ifdef</font> ARG_17_DEFAULT
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>defaulted_args;
            <font color='#009900'>// You can only set an argument's default value if it is an input argument.
</font>            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg17_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#ifndef</font> ARG_18_DEFAULT
                <font color='#009900'>// You can't define a default for argument 17 if you don't define one for argument 18 also.
</font>                <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>expected_args <font color='#5555FF'>&lt;</font> <font color='#979000'>18</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#endif</font>
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>17</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> expected_args<font face='Lucida Console'>)</font>; <font color='#009900'>// You can't define a default for an argument that doesn't exist.
</font>        <font color='#0000FF'>#endif</font>
        <font color='#0000FF'>#ifdef</font> ARG_18_DEFAULT
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>defaulted_args;
            <font color='#009900'>// You can only set an argument's default value if it is an input argument.
</font>            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg18_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#ifndef</font> ARG_19_DEFAULT
                <font color='#009900'>// You can't define a default for argument 18 if you don't define one for argument 19 also.
</font>                <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>expected_args <font color='#5555FF'>&lt;</font> <font color='#979000'>19</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#endif</font>
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>18</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> expected_args<font face='Lucida Console'>)</font>; <font color='#009900'>// You can't define a default for an argument that doesn't exist.
</font>        <font color='#0000FF'>#endif</font>
        <font color='#0000FF'>#ifdef</font> ARG_19_DEFAULT
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>defaulted_args;
            <font color='#009900'>// You can only set an argument's default value if it is an input argument.
</font>            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg19_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#ifndef</font> ARG_20_DEFAULT
                <font color='#009900'>// You can't define a default for argument 19 if you don't define one for argument 20 also.
</font>                <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>expected_args <font color='#5555FF'>&lt;</font> <font color='#979000'>20</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>#endif</font>
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>19</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> expected_args<font face='Lucida Console'>)</font>; <font color='#009900'>// You can't define a default for an argument that doesn't exist.
</font>        <font color='#0000FF'>#endif</font>
        <font color='#0000FF'>#ifdef</font> ARG_20_DEFAULT
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>defaulted_args;
            <font color='#009900'>// You can only set an argument's default value if it is an input argument.
</font>            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font>is_input_type<font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::arg20_type<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>COMPILE_TIME_ASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>20</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> expected_args<font face='Lucida Console'>)</font>; <font color='#009900'>// You can't define a default for an argument that doesn't exist.
</font>        <font color='#0000FF'>#endif</font>



        <font color='#009900'>/* check for proper number of arguments */</font>
        <font color='#0000FF'>if</font><font face='Lucida Console'>(</font>nrhs <font color='#5555FF'>&gt;</font> expected_nrhs <font color='#5555FF'>|</font><font color='#5555FF'>|</font> nrhs <font color='#5555FF'>&lt;</font> expected_nrhs <font color='#5555FF'>-</font> defaulted_args<font face='Lucida Console'>)</font> 
        <b>{</b>
            std::ostringstream sout;
            sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>Expected between </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> expected_nrhs<font color='#5555FF'>-</font>defaulted_args 
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> and </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> expected_nrhs <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> input arguments, got </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> nrhs <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>.</font>";

            <font color='#BB00BB'>mexErrMsgIdAndTxt</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>mex_function:nrhs</font>",
                              sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        <b>}</b>

        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>nlhs <font color='#5555FF'>&gt;</font> expected_nlhs<font face='Lucida Console'>)</font>
        <b>{</b>
            std::ostringstream sout;
            sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>Expected at most </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> expected_nlhs <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> output arguments, got </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> nlhs <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>.</font>";

            <font color='#BB00BB'>mexErrMsgIdAndTxt</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>mex_function:nlhs</font>",
                              sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        <b>}</b>

        call_mex_function_helper<font color='#5555FF'>&lt;</font>sig_traits<font color='#5555FF'>&lt;</font>funct<font color='#5555FF'>&gt;</font>::num_args<font color='#5555FF'>&gt;</font> helper;
        helper.<font color='#BB00BB'>callit</font><font face='Lucida Console'>(</font>f, nlhs, plhs, nrhs, prhs<font face='Lucida Console'>)</font>;

    <b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>class</font> <b><a name='mex_streambuf'></a>mex_streambuf</b> : <font color='#0000FF'>public</font> std::streambuf
    <b>{</b>

    <font color='#0000FF'>public</font>:
        <b><a name='mex_streambuf'></a>mex_streambuf</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> 
        <b>{</b>
            buf.<font color='#BB00BB'>resize</font><font face='Lucida Console'>(</font><font color='#979000'>1000</font><font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>setp</font><font face='Lucida Console'>(</font><font color='#5555FF'>&amp;</font>buf[<font color='#979000'>0</font>], <font color='#5555FF'>&amp;</font>buf[<font color='#979000'>0</font>] <font color='#5555FF'>+</font> buf.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#979000'>2</font><font face='Lucida Console'>)</font>;

            <font color='#009900'>// make cout send data to mex_streambuf
</font>            oldbuf <font color='#5555FF'>=</font> std::cout.<font color='#BB00BB'>rdbuf</font><font face='Lucida Console'>(</font><font color='#0000FF'>this</font><font face='Lucida Console'>)</font>;
        <b>}</b>

        ~<b><a name='mex_streambuf'></a>mex_streambuf</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#009900'>// put cout back to the way we found it before running our mex function.
</font>            std::cout.<font color='#BB00BB'>rdbuf</font><font face='Lucida Console'>(</font>oldbuf<font face='Lucida Console'>)</font>;
        <b>}</b>


    <font color='#0000FF'>protected</font>:


        <font color='#0000FF'><u>int</u></font> <b><a name='sync'></a>sync</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'><u>int</u></font> num <font color='#5555FF'>=</font> <font color='#0000FF'>static_cast</font><font color='#5555FF'>&lt;</font><font color='#0000FF'><u>int</u></font><font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font><font color='#BB00BB'>pptr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#BB00BB'>pbase</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>num <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
            <b>{</b>
                buf[num] <font color='#5555FF'>=</font> <font color='#979000'>0</font>; <font color='#009900'>// null terminate the string
</font>                <font color='#BB00BB'>mexPrintf</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>%s</font>",<font color='#5555FF'>&amp;</font>buf[<font color='#979000'>0</font>]<font face='Lucida Console'>)</font>;
                <font color='#BB00BB'>mexEvalString</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>drawnow</font>"<font face='Lucida Console'>)</font>; <font color='#009900'>// flush print to screen
</font>                <font color='#BB00BB'>pbump</font><font face='Lucida Console'>(</font><font color='#5555FF'>-</font>num<font face='Lucida Console'>)</font>;

                <font color='#BB00BB'>check_for_matlab_ctrl_c</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
            <b>}</b>
            <font color='#0000FF'>return</font> <font color='#979000'>0</font>;
        <b>}</b>

        int_type <b><a name='overflow'></a>overflow</b> <font face='Lucida Console'>(</font>
            int_type c
        <font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>c <font color='#5555FF'>!</font><font color='#5555FF'>=</font> EOF<font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#5555FF'>*</font><font color='#BB00BB'>pptr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> c;
                <font color='#BB00BB'>pbump</font><font face='Lucida Console'>(</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>;
            <b>}</b>
            <font color='#BB00BB'>sync</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>return</font> c;
        <b>}</b>

    <font color='#0000FF'>private</font>:
        std::vector<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>char</u></font><font color='#5555FF'>&gt;</font> buf;
        std::streambuf<font color='#5555FF'>*</font> oldbuf;

    <b>}</b>;

    <font color='#0000FF'>class</font> <b><a name='mex_warn_streambuf'></a>mex_warn_streambuf</b> : <font color='#0000FF'>public</font> std::streambuf
    <b>{</b>

    <font color='#0000FF'>public</font>:
        <b><a name='mex_warn_streambuf'></a>mex_warn_streambuf</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> 
        <b>{</b>
            buf.<font color='#BB00BB'>resize</font><font face='Lucida Console'>(</font><font color='#979000'>1000</font><font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>setp</font><font face='Lucida Console'>(</font><font color='#5555FF'>&amp;</font>buf[<font color='#979000'>0</font>], <font color='#5555FF'>&amp;</font>buf[<font color='#979000'>0</font>] <font color='#5555FF'>+</font> buf.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#979000'>2</font><font face='Lucida Console'>)</font>;

            <font color='#009900'>// make cout send data to mex_warn_streambuf
</font>            oldbuf <font color='#5555FF'>=</font> std::cerr.<font color='#BB00BB'>rdbuf</font><font face='Lucida Console'>(</font><font color='#0000FF'>this</font><font face='Lucida Console'>)</font>;
        <b>}</b>

        ~<b><a name='mex_warn_streambuf'></a>mex_warn_streambuf</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#009900'>// put cerr back to the way we found it before running our mex function.
</font>            std::cerr.<font color='#BB00BB'>rdbuf</font><font face='Lucida Console'>(</font>oldbuf<font face='Lucida Console'>)</font>;
        <b>}</b>

    <font color='#0000FF'>protected</font>:


        <font color='#0000FF'><u>int</u></font> <b><a name='sync'></a>sync</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'><u>int</u></font> num <font color='#5555FF'>=</font> <font color='#0000FF'>static_cast</font><font color='#5555FF'>&lt;</font><font color='#0000FF'><u>int</u></font><font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font><font color='#BB00BB'>pptr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#BB00BB'>pbase</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>num <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
            <b>{</b>
                buf[num] <font color='#5555FF'>=</font> <font color='#979000'>0</font>; <font color='#009900'>// null terminate the string
</font>                <font color='#BB00BB'>mexWarnMsgTxt</font><font face='Lucida Console'>(</font><font color='#5555FF'>&amp;</font>buf[<font color='#979000'>0</font>]<font face='Lucida Console'>)</font>;
                <font color='#BB00BB'>mexEvalString</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>drawnow</font>"<font face='Lucida Console'>)</font>; <font color='#009900'>// flush print to screen
</font>                <font color='#BB00BB'>pbump</font><font face='Lucida Console'>(</font><font color='#5555FF'>-</font>num<font face='Lucida Console'>)</font>;

                <font color='#BB00BB'>check_for_matlab_ctrl_c</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
            <b>}</b>
            <font color='#0000FF'>return</font> <font color='#979000'>0</font>;
        <b>}</b>

        int_type <b><a name='overflow'></a>overflow</b> <font face='Lucida Console'>(</font>
            int_type c
        <font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>c <font color='#5555FF'>!</font><font color='#5555FF'>=</font> EOF<font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#5555FF'>*</font><font color='#BB00BB'>pptr</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font> c;
                <font color='#BB00BB'>pbump</font><font face='Lucida Console'>(</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>;
            <b>}</b>
            <font color='#BB00BB'>sync</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>return</font> c;
        <b>}</b>

    <font color='#0000FF'>private</font>:
        std::vector<font color='#5555FF'>&lt;</font><font color='#0000FF'><u>char</u></font><font color='#5555FF'>&gt;</font> buf;
        std::streambuf<font color='#5555FF'>*</font> oldbuf;

    <b>}</b>;

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='setup_input_args'></a>setup_input_args</b> <font face='Lucida Console'>(</font>
        mxArray<font color='#5555FF'>*</font><font color='#5555FF'>&amp;</font> array,
        <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> item,
        <font color='#0000FF'><u>int</u></font><font color='#5555FF'>&amp;</font> nrhs
    <font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>array, item<font face='Lucida Console'>)</font>;
        <font color='#5555FF'>+</font><font color='#5555FF'>+</font>nrhs;
    <b>}</b>

    <font color='#0000FF'><u>void</u></font> <b><a name='setup_input_args'></a>setup_input_args</b> <font face='Lucida Console'>(</font>
        mxArray<font color='#5555FF'>*</font><font color='#5555FF'>&amp;</font> array,
        <font color='#0000FF'>const</font> function_handle<font color='#5555FF'>&amp;</font> item,
        <font color='#0000FF'><u>int</u></font><font color='#5555FF'>&amp;</font> nrhs
    <font face='Lucida Console'>)</font>
    <b>{</b>
        array <font color='#5555FF'>=</font> <font color='#0000FF'>static_cast</font><font color='#5555FF'>&lt;</font>mxArray<font color='#5555FF'>*</font><font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>item.h<font face='Lucida Console'>)</font>;
        <font color='#5555FF'>+</font><font color='#5555FF'>+</font>nrhs;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='setup_input_args'></a>setup_input_args</b> <font face='Lucida Console'>(</font>
        mxArray<font color='#5555FF'>*</font><font color='#5555FF'>&amp;</font> array,
        <font color='#0000FF'>const</font> output_decorator<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> item,
        <font color='#0000FF'><u>int</u></font><font color='#5555FF'>&amp;</font> nrhs
    <font face='Lucida Console'>)</font>
    <b>{</b>
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='setup_output_args'></a>setup_output_args</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        mxArray<font color='#5555FF'>*</font> array,
        <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> item,
        <font color='#0000FF'><u>int</u></font><font color='#5555FF'>&amp;</font> nrhs
    <font face='Lucida Console'>)</font>
    <b>{</b>
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='setup_output_args'></a>setup_output_args</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        mxArray<font color='#5555FF'>*</font> array,
        <font color='#0000FF'>const</font> output_decorator<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> item,
        <font color='#0000FF'><u>int</u></font><font color='#5555FF'>&amp;</font> i
    <font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#0000FF'>try</font>
        <b>{</b>
            <font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font>i,array,<font color='#0000FF'>const_cast</font><font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&amp;</font><font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>item.item<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
            <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i;
        <b>}</b>
        <font color='#0000FF'>catch</font> <font face='Lucida Console'>(</font>invalid_args_exception<font color='#5555FF'>&amp;</font> e<font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'>throw</font> dlib::<font color='#BB00BB'>error</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>Error occurred calling MATLAB function '</font>" <font color='#5555FF'>+</font> function_name <font color='#5555FF'>+</font> "<font color='#CC0000'>' from mex file. \n</font>"
                              "<font color='#CC0000'>The MATLAB function didn't return what we expected it to.  \nIn particular, return</font>" <font color='#5555FF'>+</font> e.msg<font face='Lucida Console'>)</font>;
        <b>}</b>
    <b>}</b>

    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab_for_real'></a>call_matlab_for_real</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'><u>int</u></font> nlhs,
        mxArray<font color='#5555FF'>*</font> plhs[],
        <font color='#0000FF'><u>int</u></font> nrhs,
        mxArray<font color='#5555FF'>*</font> prhs[],
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name
    <font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#0000FF'><u>int</u></font> status <font color='#5555FF'>=</font> <font color='#BB00BB'>mexCallMATLAB</font><font face='Lucida Console'>(</font>nlhs, plhs, nrhs, prhs, function_name.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>status<font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'>throw</font> dlib::<font color='#BB00BB'>error</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>Error, an exception was thrown when we tried to call the MATLAB function '</font>" <font color='#5555FF'>+</font> function_name <font color='#5555FF'>+</font> "<font color='#CC0000'>'.</font>"<font face='Lucida Console'>)</font>;
        <b>}</b>
    <b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>namespace</font> dlib
<b>{</b>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;

        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,NULL,<font color='#979000'>0</font>,NULL, function_name<font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T1<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='free_callback_resources'></a>free_callback_resources</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'><u>int</u></font> nlhs,
        mxArray<font color='#5555FF'>*</font> plhs[],
        <font color='#0000FF'><u>int</u></font> nrhs,
        mxArray<font color='#5555FF'>*</font> prhs[]
    <font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#009900'>// free resources
</font>        <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>; i <font color='#5555FF'>&lt;</font> nlhs; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
            <font color='#BB00BB'>mxDestroyArray</font><font face='Lucida Console'>(</font>plhs[i]<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>; i <font color='#5555FF'>&lt;</font> nrhs; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#009900'>// don't call mxDestroyArray() on function handles (which should only ever be in prhs[0])
</font>            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>i <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>0</font> <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> dlib::is_same_type<font color='#5555FF'>&lt;</font>T1,function_handle<font color='#5555FF'>&gt;</font>::value<font face='Lucida Console'>)</font>
                <font color='#0000FF'>continue</font>;
            <font color='#BB00BB'>mxDestroyArray</font><font face='Lucida Console'>(</font>prhs[i]<font face='Lucida Console'>)</font>;
        <b>}</b>
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T1
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        <font color='#0000FF'>const</font> T1<font color='#5555FF'>&amp;</font> A1
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_args <font color='#5555FF'>=</font> <font color='#979000'>1</font>;
        mxArray<font color='#5555FF'>*</font> plhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;
        mxArray<font color='#5555FF'>*</font> prhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;

        <font color='#0000FF'><u>int</u></font> nrhs <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A1, nrhs<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> nlhs <font color='#5555FF'>=</font> num_args <font color='#5555FF'>-</font> nrhs;
        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs, function_name<font face='Lucida Console'>)</font>;

        <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A1, i<font face='Lucida Console'>)</font>;

        free_callback_resources<font color='#5555FF'>&lt;</font>T1<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs<font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T1, 
        <font color='#0000FF'>typename</font> T2
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        <font color='#0000FF'>const</font> T1<font color='#5555FF'>&amp;</font> A1,
        <font color='#0000FF'>const</font> T2<font color='#5555FF'>&amp;</font> A2
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_args <font color='#5555FF'>=</font> <font color='#979000'>2</font>;
        mxArray<font color='#5555FF'>*</font> plhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;
        mxArray<font color='#5555FF'>*</font> prhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;

        <font color='#0000FF'><u>int</u></font> nrhs <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A1, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A2, nrhs<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> nlhs <font color='#5555FF'>=</font> num_args <font color='#5555FF'>-</font> nrhs;
        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs, function_name<font face='Lucida Console'>)</font>;

        <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A1, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A2, i<font face='Lucida Console'>)</font>;

        free_callback_resources<font color='#5555FF'>&lt;</font>T1<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs<font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T1, 
        <font color='#0000FF'>typename</font> T2,
        <font color='#0000FF'>typename</font> T3
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        <font color='#0000FF'>const</font> T1<font color='#5555FF'>&amp;</font> A1,
        <font color='#0000FF'>const</font> T2<font color='#5555FF'>&amp;</font> A2,
        <font color='#0000FF'>const</font> T3<font color='#5555FF'>&amp;</font> A3
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_args <font color='#5555FF'>=</font> <font color='#979000'>3</font>;
        mxArray<font color='#5555FF'>*</font> plhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;
        mxArray<font color='#5555FF'>*</font> prhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;

        <font color='#0000FF'><u>int</u></font> nrhs <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A1, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A2, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A3, nrhs<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> nlhs <font color='#5555FF'>=</font> num_args <font color='#5555FF'>-</font> nrhs;
        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs, function_name<font face='Lucida Console'>)</font>;

        <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A1, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A2, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A3, i<font face='Lucida Console'>)</font>;

        free_callback_resources<font color='#5555FF'>&lt;</font>T1<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs<font face='Lucida Console'>)</font>;
    <b>}</b>


    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T1, 
        <font color='#0000FF'>typename</font> T2,
        <font color='#0000FF'>typename</font> T3,
        <font color='#0000FF'>typename</font> T4
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        <font color='#0000FF'>const</font> T1<font color='#5555FF'>&amp;</font> A1,
        <font color='#0000FF'>const</font> T2<font color='#5555FF'>&amp;</font> A2,
        <font color='#0000FF'>const</font> T3<font color='#5555FF'>&amp;</font> A3,
        <font color='#0000FF'>const</font> T4<font color='#5555FF'>&amp;</font> A4
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_args <font color='#5555FF'>=</font> <font color='#979000'>4</font>;
        mxArray<font color='#5555FF'>*</font> plhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;
        mxArray<font color='#5555FF'>*</font> prhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;

        <font color='#0000FF'><u>int</u></font> nrhs <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A1, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A2, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A3, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A4, nrhs<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> nlhs <font color='#5555FF'>=</font> num_args <font color='#5555FF'>-</font> nrhs;
        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs, function_name<font face='Lucida Console'>)</font>;

        <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A1, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A2, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A3, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A4, i<font face='Lucida Console'>)</font>;

        free_callback_resources<font color='#5555FF'>&lt;</font>T1<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs<font face='Lucida Console'>)</font>;
    <b>}</b>


    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T1, 
        <font color='#0000FF'>typename</font> T2,
        <font color='#0000FF'>typename</font> T3,
        <font color='#0000FF'>typename</font> T4,
        <font color='#0000FF'>typename</font> T5
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        <font color='#0000FF'>const</font> T1<font color='#5555FF'>&amp;</font> A1,
        <font color='#0000FF'>const</font> T2<font color='#5555FF'>&amp;</font> A2,
        <font color='#0000FF'>const</font> T3<font color='#5555FF'>&amp;</font> A3,
        <font color='#0000FF'>const</font> T4<font color='#5555FF'>&amp;</font> A4,
        <font color='#0000FF'>const</font> T5<font color='#5555FF'>&amp;</font> A5
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_args <font color='#5555FF'>=</font> <font color='#979000'>5</font>;
        mxArray<font color='#5555FF'>*</font> plhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;
        mxArray<font color='#5555FF'>*</font> prhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;

        <font color='#0000FF'><u>int</u></font> nrhs <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A1, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A2, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A3, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A4, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A5, nrhs<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> nlhs <font color='#5555FF'>=</font> num_args <font color='#5555FF'>-</font> nrhs;
        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs, function_name<font face='Lucida Console'>)</font>;

        <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A1, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A2, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A3, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A4, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A5, i<font face='Lucida Console'>)</font>;

        free_callback_resources<font color='#5555FF'>&lt;</font>T1<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs<font face='Lucida Console'>)</font>;
    <b>}</b>


    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T1, 
        <font color='#0000FF'>typename</font> T2,
        <font color='#0000FF'>typename</font> T3,
        <font color='#0000FF'>typename</font> T4,
        <font color='#0000FF'>typename</font> T5,
        <font color='#0000FF'>typename</font> T6
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        <font color='#0000FF'>const</font> T1<font color='#5555FF'>&amp;</font> A1,
        <font color='#0000FF'>const</font> T2<font color='#5555FF'>&amp;</font> A2,
        <font color='#0000FF'>const</font> T3<font color='#5555FF'>&amp;</font> A3,
        <font color='#0000FF'>const</font> T4<font color='#5555FF'>&amp;</font> A4,
        <font color='#0000FF'>const</font> T5<font color='#5555FF'>&amp;</font> A5,
        <font color='#0000FF'>const</font> T6<font color='#5555FF'>&amp;</font> A6
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_args <font color='#5555FF'>=</font> <font color='#979000'>6</font>;
        mxArray<font color='#5555FF'>*</font> plhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;
        mxArray<font color='#5555FF'>*</font> prhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;

        <font color='#0000FF'><u>int</u></font> nrhs <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A1, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A2, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A3, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A4, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A5, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A6, nrhs<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> nlhs <font color='#5555FF'>=</font> num_args <font color='#5555FF'>-</font> nrhs;
        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs, function_name<font face='Lucida Console'>)</font>;

        <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A1, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A2, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A3, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A4, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A5, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A6, i<font face='Lucida Console'>)</font>;

        free_callback_resources<font color='#5555FF'>&lt;</font>T1<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs<font face='Lucida Console'>)</font>;
    <b>}</b>


    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T1, 
        <font color='#0000FF'>typename</font> T2,
        <font color='#0000FF'>typename</font> T3,
        <font color='#0000FF'>typename</font> T4,
        <font color='#0000FF'>typename</font> T5,
        <font color='#0000FF'>typename</font> T6,
        <font color='#0000FF'>typename</font> T7
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        <font color='#0000FF'>const</font> T1<font color='#5555FF'>&amp;</font> A1,
        <font color='#0000FF'>const</font> T2<font color='#5555FF'>&amp;</font> A2,
        <font color='#0000FF'>const</font> T3<font color='#5555FF'>&amp;</font> A3,
        <font color='#0000FF'>const</font> T4<font color='#5555FF'>&amp;</font> A4,
        <font color='#0000FF'>const</font> T5<font color='#5555FF'>&amp;</font> A5,
        <font color='#0000FF'>const</font> T6<font color='#5555FF'>&amp;</font> A6,
        <font color='#0000FF'>const</font> T7<font color='#5555FF'>&amp;</font> A7
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_args <font color='#5555FF'>=</font> <font color='#979000'>7</font>;
        mxArray<font color='#5555FF'>*</font> plhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;
        mxArray<font color='#5555FF'>*</font> prhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;

        <font color='#0000FF'><u>int</u></font> nrhs <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A1, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A2, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A3, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A4, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A5, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A6, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A7, nrhs<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> nlhs <font color='#5555FF'>=</font> num_args <font color='#5555FF'>-</font> nrhs;
        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs, function_name<font face='Lucida Console'>)</font>;

        <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A1, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A2, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A3, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A4, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A5, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A6, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A7, i<font face='Lucida Console'>)</font>;

        free_callback_resources<font color='#5555FF'>&lt;</font>T1<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs<font face='Lucida Console'>)</font>;
    <b>}</b>


    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T1, 
        <font color='#0000FF'>typename</font> T2,
        <font color='#0000FF'>typename</font> T3,
        <font color='#0000FF'>typename</font> T4,
        <font color='#0000FF'>typename</font> T5,
        <font color='#0000FF'>typename</font> T6,
        <font color='#0000FF'>typename</font> T7,
        <font color='#0000FF'>typename</font> T8
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        <font color='#0000FF'>const</font> T1<font color='#5555FF'>&amp;</font> A1,
        <font color='#0000FF'>const</font> T2<font color='#5555FF'>&amp;</font> A2,
        <font color='#0000FF'>const</font> T3<font color='#5555FF'>&amp;</font> A3,
        <font color='#0000FF'>const</font> T4<font color='#5555FF'>&amp;</font> A4,
        <font color='#0000FF'>const</font> T5<font color='#5555FF'>&amp;</font> A5,
        <font color='#0000FF'>const</font> T6<font color='#5555FF'>&amp;</font> A6,
        <font color='#0000FF'>const</font> T7<font color='#5555FF'>&amp;</font> A7,
        <font color='#0000FF'>const</font> T8<font color='#5555FF'>&amp;</font> A8
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_args <font color='#5555FF'>=</font> <font color='#979000'>8</font>;
        mxArray<font color='#5555FF'>*</font> plhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;
        mxArray<font color='#5555FF'>*</font> prhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;

        <font color='#0000FF'><u>int</u></font> nrhs <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A1, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A2, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A3, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A4, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A5, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A6, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A7, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A8, nrhs<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> nlhs <font color='#5555FF'>=</font> num_args <font color='#5555FF'>-</font> nrhs;
        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs, function_name<font face='Lucida Console'>)</font>;

        <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A1, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A2, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A3, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A4, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A5, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A6, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A7, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A8, i<font face='Lucida Console'>)</font>;

        free_callback_resources<font color='#5555FF'>&lt;</font>T1<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs<font face='Lucida Console'>)</font>;
    <b>}</b>



    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T1, 
        <font color='#0000FF'>typename</font> T2,
        <font color='#0000FF'>typename</font> T3,
        <font color='#0000FF'>typename</font> T4,
        <font color='#0000FF'>typename</font> T5,
        <font color='#0000FF'>typename</font> T6,
        <font color='#0000FF'>typename</font> T7,
        <font color='#0000FF'>typename</font> T8,
        <font color='#0000FF'>typename</font> T9
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        <font color='#0000FF'>const</font> T1<font color='#5555FF'>&amp;</font> A1,
        <font color='#0000FF'>const</font> T2<font color='#5555FF'>&amp;</font> A2,
        <font color='#0000FF'>const</font> T3<font color='#5555FF'>&amp;</font> A3,
        <font color='#0000FF'>const</font> T4<font color='#5555FF'>&amp;</font> A4,
        <font color='#0000FF'>const</font> T5<font color='#5555FF'>&amp;</font> A5,
        <font color='#0000FF'>const</font> T6<font color='#5555FF'>&amp;</font> A6,
        <font color='#0000FF'>const</font> T7<font color='#5555FF'>&amp;</font> A7,
        <font color='#0000FF'>const</font> T8<font color='#5555FF'>&amp;</font> A8,
        <font color='#0000FF'>const</font> T9<font color='#5555FF'>&amp;</font> A9
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_args <font color='#5555FF'>=</font> <font color='#979000'>9</font>;
        mxArray<font color='#5555FF'>*</font> plhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;
        mxArray<font color='#5555FF'>*</font> prhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;

        <font color='#0000FF'><u>int</u></font> nrhs <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A1, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A2, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A3, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A4, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A5, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A6, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A7, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A8, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A9, nrhs<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> nlhs <font color='#5555FF'>=</font> num_args <font color='#5555FF'>-</font> nrhs;
        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs, function_name<font face='Lucida Console'>)</font>;

        <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A1, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A2, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A3, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A4, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A5, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A6, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A7, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A8, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A9, i<font face='Lucida Console'>)</font>;

        free_callback_resources<font color='#5555FF'>&lt;</font>T1<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs<font face='Lucida Console'>)</font>;
    <b>}</b>


    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T1, 
        <font color='#0000FF'>typename</font> T2,
        <font color='#0000FF'>typename</font> T3,
        <font color='#0000FF'>typename</font> T4,
        <font color='#0000FF'>typename</font> T5,
        <font color='#0000FF'>typename</font> T6,
        <font color='#0000FF'>typename</font> T7,
        <font color='#0000FF'>typename</font> T8,
        <font color='#0000FF'>typename</font> T9,
        <font color='#0000FF'>typename</font> T10
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        <font color='#0000FF'>const</font> T1<font color='#5555FF'>&amp;</font> A1,
        <font color='#0000FF'>const</font> T2<font color='#5555FF'>&amp;</font> A2,
        <font color='#0000FF'>const</font> T3<font color='#5555FF'>&amp;</font> A3,
        <font color='#0000FF'>const</font> T4<font color='#5555FF'>&amp;</font> A4,
        <font color='#0000FF'>const</font> T5<font color='#5555FF'>&amp;</font> A5,
        <font color='#0000FF'>const</font> T6<font color='#5555FF'>&amp;</font> A6,
        <font color='#0000FF'>const</font> T7<font color='#5555FF'>&amp;</font> A7,
        <font color='#0000FF'>const</font> T8<font color='#5555FF'>&amp;</font> A8,
        <font color='#0000FF'>const</font> T9<font color='#5555FF'>&amp;</font> A9,
        <font color='#0000FF'>const</font> T10<font color='#5555FF'>&amp;</font> A10
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_args <font color='#5555FF'>=</font> <font color='#979000'>10</font>;
        mxArray<font color='#5555FF'>*</font> plhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;
        mxArray<font color='#5555FF'>*</font> prhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;

        <font color='#0000FF'><u>int</u></font> nrhs <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A1, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A2, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A3, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A4, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A5, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A6, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A7, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A8, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A9, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A10, nrhs<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> nlhs <font color='#5555FF'>=</font> num_args <font color='#5555FF'>-</font> nrhs;
        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs, function_name<font face='Lucida Console'>)</font>;

        <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A1, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A2, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A3, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A4, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A5, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A6, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A7, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A8, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A9, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A10, i<font face='Lucida Console'>)</font>;

        free_callback_resources<font color='#5555FF'>&lt;</font>T1<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs<font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T1, 
        <font color='#0000FF'>typename</font> T2,
        <font color='#0000FF'>typename</font> T3,
        <font color='#0000FF'>typename</font> T4,
        <font color='#0000FF'>typename</font> T5,
        <font color='#0000FF'>typename</font> T6,
        <font color='#0000FF'>typename</font> T7,
        <font color='#0000FF'>typename</font> T8,
        <font color='#0000FF'>typename</font> T9,
        <font color='#0000FF'>typename</font> T10,
        <font color='#0000FF'>typename</font> T11
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        <font color='#0000FF'>const</font> T1<font color='#5555FF'>&amp;</font> A1,
        <font color='#0000FF'>const</font> T2<font color='#5555FF'>&amp;</font> A2,
        <font color='#0000FF'>const</font> T3<font color='#5555FF'>&amp;</font> A3,
        <font color='#0000FF'>const</font> T4<font color='#5555FF'>&amp;</font> A4,
        <font color='#0000FF'>const</font> T5<font color='#5555FF'>&amp;</font> A5,
        <font color='#0000FF'>const</font> T6<font color='#5555FF'>&amp;</font> A6,
        <font color='#0000FF'>const</font> T7<font color='#5555FF'>&amp;</font> A7,
        <font color='#0000FF'>const</font> T8<font color='#5555FF'>&amp;</font> A8,
        <font color='#0000FF'>const</font> T9<font color='#5555FF'>&amp;</font> A9,
        <font color='#0000FF'>const</font> T10<font color='#5555FF'>&amp;</font> A10,
        <font color='#0000FF'>const</font> T11<font color='#5555FF'>&amp;</font> A11
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_args <font color='#5555FF'>=</font> <font color='#979000'>11</font>;
        mxArray<font color='#5555FF'>*</font> plhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;
        mxArray<font color='#5555FF'>*</font> prhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;

        <font color='#0000FF'><u>int</u></font> nrhs <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A1, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A2, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A3, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A4, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A5, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A6, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A7, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A8, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A9, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A10, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A11, nrhs<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> nlhs <font color='#5555FF'>=</font> num_args <font color='#5555FF'>-</font> nrhs;
        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs, function_name<font face='Lucida Console'>)</font>;

        <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A1, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A2, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A3, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A4, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A5, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A6, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A7, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A8, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A9, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A10, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A11, i<font face='Lucida Console'>)</font>;

        free_callback_resources<font color='#5555FF'>&lt;</font>T1<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs<font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T1, 
        <font color='#0000FF'>typename</font> T2,
        <font color='#0000FF'>typename</font> T3,
        <font color='#0000FF'>typename</font> T4,
        <font color='#0000FF'>typename</font> T5,
        <font color='#0000FF'>typename</font> T6,
        <font color='#0000FF'>typename</font> T7,
        <font color='#0000FF'>typename</font> T8,
        <font color='#0000FF'>typename</font> T9,
        <font color='#0000FF'>typename</font> T10,
        <font color='#0000FF'>typename</font> T11,
        <font color='#0000FF'>typename</font> T12
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        <font color='#0000FF'>const</font> T1<font color='#5555FF'>&amp;</font> A1,
        <font color='#0000FF'>const</font> T2<font color='#5555FF'>&amp;</font> A2,
        <font color='#0000FF'>const</font> T3<font color='#5555FF'>&amp;</font> A3,
        <font color='#0000FF'>const</font> T4<font color='#5555FF'>&amp;</font> A4,
        <font color='#0000FF'>const</font> T5<font color='#5555FF'>&amp;</font> A5,
        <font color='#0000FF'>const</font> T6<font color='#5555FF'>&amp;</font> A6,
        <font color='#0000FF'>const</font> T7<font color='#5555FF'>&amp;</font> A7,
        <font color='#0000FF'>const</font> T8<font color='#5555FF'>&amp;</font> A8,
        <font color='#0000FF'>const</font> T9<font color='#5555FF'>&amp;</font> A9,
        <font color='#0000FF'>const</font> T10<font color='#5555FF'>&amp;</font> A10,
        <font color='#0000FF'>const</font> T11<font color='#5555FF'>&amp;</font> A11,
        <font color='#0000FF'>const</font> T12<font color='#5555FF'>&amp;</font> A12
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_args <font color='#5555FF'>=</font> <font color='#979000'>12</font>;
        mxArray<font color='#5555FF'>*</font> plhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;
        mxArray<font color='#5555FF'>*</font> prhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;

        <font color='#0000FF'><u>int</u></font> nrhs <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A1, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A2, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A3, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A4, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A5, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A6, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A7, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A8, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A9, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A10, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A11, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A12, nrhs<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> nlhs <font color='#5555FF'>=</font> num_args <font color='#5555FF'>-</font> nrhs;
        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs, function_name<font face='Lucida Console'>)</font>;

        <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A1, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A2, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A3, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A4, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A5, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A6, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A7, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A8, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A9, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A10, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A11, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A12, i<font face='Lucida Console'>)</font>;

        free_callback_resources<font color='#5555FF'>&lt;</font>T1<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs<font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T1, 
        <font color='#0000FF'>typename</font> T2,
        <font color='#0000FF'>typename</font> T3,
        <font color='#0000FF'>typename</font> T4,
        <font color='#0000FF'>typename</font> T5,
        <font color='#0000FF'>typename</font> T6,
        <font color='#0000FF'>typename</font> T7,
        <font color='#0000FF'>typename</font> T8,
        <font color='#0000FF'>typename</font> T9,
        <font color='#0000FF'>typename</font> T10,
        <font color='#0000FF'>typename</font> T11,
        <font color='#0000FF'>typename</font> T12,
        <font color='#0000FF'>typename</font> T13
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        <font color='#0000FF'>const</font> T1<font color='#5555FF'>&amp;</font> A1,
        <font color='#0000FF'>const</font> T2<font color='#5555FF'>&amp;</font> A2,
        <font color='#0000FF'>const</font> T3<font color='#5555FF'>&amp;</font> A3,
        <font color='#0000FF'>const</font> T4<font color='#5555FF'>&amp;</font> A4,
        <font color='#0000FF'>const</font> T5<font color='#5555FF'>&amp;</font> A5,
        <font color='#0000FF'>const</font> T6<font color='#5555FF'>&amp;</font> A6,
        <font color='#0000FF'>const</font> T7<font color='#5555FF'>&amp;</font> A7,
        <font color='#0000FF'>const</font> T8<font color='#5555FF'>&amp;</font> A8,
        <font color='#0000FF'>const</font> T9<font color='#5555FF'>&amp;</font> A9,
        <font color='#0000FF'>const</font> T10<font color='#5555FF'>&amp;</font> A10,
        <font color='#0000FF'>const</font> T11<font color='#5555FF'>&amp;</font> A11,
        <font color='#0000FF'>const</font> T12<font color='#5555FF'>&amp;</font> A12,
        <font color='#0000FF'>const</font> T13<font color='#5555FF'>&amp;</font> A13
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_args <font color='#5555FF'>=</font> <font color='#979000'>13</font>;
        mxArray<font color='#5555FF'>*</font> plhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;
        mxArray<font color='#5555FF'>*</font> prhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;

        <font color='#0000FF'><u>int</u></font> nrhs <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A1, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A2, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A3, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A4, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A5, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A6, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A7, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A8, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A9, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A10, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A11, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A12, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A13, nrhs<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> nlhs <font color='#5555FF'>=</font> num_args <font color='#5555FF'>-</font> nrhs;
        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs, function_name<font face='Lucida Console'>)</font>;

        <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A1, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A2, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A3, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A4, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A5, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A6, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A7, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A8, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A9, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A10, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A11, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A12, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A13, i<font face='Lucida Console'>)</font>;

        free_callback_resources<font color='#5555FF'>&lt;</font>T1<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs<font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T1, 
        <font color='#0000FF'>typename</font> T2,
        <font color='#0000FF'>typename</font> T3,
        <font color='#0000FF'>typename</font> T4,
        <font color='#0000FF'>typename</font> T5,
        <font color='#0000FF'>typename</font> T6,
        <font color='#0000FF'>typename</font> T7,
        <font color='#0000FF'>typename</font> T8,
        <font color='#0000FF'>typename</font> T9,
        <font color='#0000FF'>typename</font> T10,
        <font color='#0000FF'>typename</font> T11,
        <font color='#0000FF'>typename</font> T12,
        <font color='#0000FF'>typename</font> T13,
        <font color='#0000FF'>typename</font> T14
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        <font color='#0000FF'>const</font> T1<font color='#5555FF'>&amp;</font> A1,
        <font color='#0000FF'>const</font> T2<font color='#5555FF'>&amp;</font> A2,
        <font color='#0000FF'>const</font> T3<font color='#5555FF'>&amp;</font> A3,
        <font color='#0000FF'>const</font> T4<font color='#5555FF'>&amp;</font> A4,
        <font color='#0000FF'>const</font> T5<font color='#5555FF'>&amp;</font> A5,
        <font color='#0000FF'>const</font> T6<font color='#5555FF'>&amp;</font> A6,
        <font color='#0000FF'>const</font> T7<font color='#5555FF'>&amp;</font> A7,
        <font color='#0000FF'>const</font> T8<font color='#5555FF'>&amp;</font> A8,
        <font color='#0000FF'>const</font> T9<font color='#5555FF'>&amp;</font> A9,
        <font color='#0000FF'>const</font> T10<font color='#5555FF'>&amp;</font> A10,
        <font color='#0000FF'>const</font> T11<font color='#5555FF'>&amp;</font> A11,
        <font color='#0000FF'>const</font> T12<font color='#5555FF'>&amp;</font> A12,
        <font color='#0000FF'>const</font> T13<font color='#5555FF'>&amp;</font> A13,
        <font color='#0000FF'>const</font> T14<font color='#5555FF'>&amp;</font> A14
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_args <font color='#5555FF'>=</font> <font color='#979000'>14</font>;
        mxArray<font color='#5555FF'>*</font> plhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;
        mxArray<font color='#5555FF'>*</font> prhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;

        <font color='#0000FF'><u>int</u></font> nrhs <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A1, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A2, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A3, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A4, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A5, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A6, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A7, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A8, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A9, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A10, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A11, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A12, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A13, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A14, nrhs<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> nlhs <font color='#5555FF'>=</font> num_args <font color='#5555FF'>-</font> nrhs;
        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs, function_name<font face='Lucida Console'>)</font>;

        <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A1, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A2, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A3, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A4, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A5, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A6, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A7, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A8, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A9, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A10, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A11, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A12, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A13, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A14, i<font face='Lucida Console'>)</font>;

        free_callback_resources<font color='#5555FF'>&lt;</font>T1<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs<font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T1, 
        <font color='#0000FF'>typename</font> T2,
        <font color='#0000FF'>typename</font> T3,
        <font color='#0000FF'>typename</font> T4,
        <font color='#0000FF'>typename</font> T5,
        <font color='#0000FF'>typename</font> T6,
        <font color='#0000FF'>typename</font> T7,
        <font color='#0000FF'>typename</font> T8,
        <font color='#0000FF'>typename</font> T9,
        <font color='#0000FF'>typename</font> T10,
        <font color='#0000FF'>typename</font> T11,
        <font color='#0000FF'>typename</font> T12,
        <font color='#0000FF'>typename</font> T13,
        <font color='#0000FF'>typename</font> T14,
        <font color='#0000FF'>typename</font> T15
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        <font color='#0000FF'>const</font> T1<font color='#5555FF'>&amp;</font> A1,
        <font color='#0000FF'>const</font> T2<font color='#5555FF'>&amp;</font> A2,
        <font color='#0000FF'>const</font> T3<font color='#5555FF'>&amp;</font> A3,
        <font color='#0000FF'>const</font> T4<font color='#5555FF'>&amp;</font> A4,
        <font color='#0000FF'>const</font> T5<font color='#5555FF'>&amp;</font> A5,
        <font color='#0000FF'>const</font> T6<font color='#5555FF'>&amp;</font> A6,
        <font color='#0000FF'>const</font> T7<font color='#5555FF'>&amp;</font> A7,
        <font color='#0000FF'>const</font> T8<font color='#5555FF'>&amp;</font> A8,
        <font color='#0000FF'>const</font> T9<font color='#5555FF'>&amp;</font> A9,
        <font color='#0000FF'>const</font> T10<font color='#5555FF'>&amp;</font> A10,
        <font color='#0000FF'>const</font> T11<font color='#5555FF'>&amp;</font> A11,
        <font color='#0000FF'>const</font> T12<font color='#5555FF'>&amp;</font> A12,
        <font color='#0000FF'>const</font> T13<font color='#5555FF'>&amp;</font> A13,
        <font color='#0000FF'>const</font> T14<font color='#5555FF'>&amp;</font> A14,
        <font color='#0000FF'>const</font> T15<font color='#5555FF'>&amp;</font> A15
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_args <font color='#5555FF'>=</font> <font color='#979000'>15</font>;
        mxArray<font color='#5555FF'>*</font> plhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;
        mxArray<font color='#5555FF'>*</font> prhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;

        <font color='#0000FF'><u>int</u></font> nrhs <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A1, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A2, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A3, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A4, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A5, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A6, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A7, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A8, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A9, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A10, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A11, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A12, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A13, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A14, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A15, nrhs<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> nlhs <font color='#5555FF'>=</font> num_args <font color='#5555FF'>-</font> nrhs;
        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs, function_name<font face='Lucida Console'>)</font>;

        <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A1, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A2, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A3, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A4, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A5, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A6, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A7, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A8, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A9, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A10, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A11, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A12, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A13, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A14, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A15, i<font face='Lucida Console'>)</font>;

        free_callback_resources<font color='#5555FF'>&lt;</font>T1<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs<font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T1, 
        <font color='#0000FF'>typename</font> T2,
        <font color='#0000FF'>typename</font> T3,
        <font color='#0000FF'>typename</font> T4,
        <font color='#0000FF'>typename</font> T5,
        <font color='#0000FF'>typename</font> T6,
        <font color='#0000FF'>typename</font> T7,
        <font color='#0000FF'>typename</font> T8,
        <font color='#0000FF'>typename</font> T9,
        <font color='#0000FF'>typename</font> T10,
        <font color='#0000FF'>typename</font> T11,
        <font color='#0000FF'>typename</font> T12,
        <font color='#0000FF'>typename</font> T13,
        <font color='#0000FF'>typename</font> T14,
        <font color='#0000FF'>typename</font> T15,
        <font color='#0000FF'>typename</font> T16
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        <font color='#0000FF'>const</font> T1<font color='#5555FF'>&amp;</font> A1,
        <font color='#0000FF'>const</font> T2<font color='#5555FF'>&amp;</font> A2,
        <font color='#0000FF'>const</font> T3<font color='#5555FF'>&amp;</font> A3,
        <font color='#0000FF'>const</font> T4<font color='#5555FF'>&amp;</font> A4,
        <font color='#0000FF'>const</font> T5<font color='#5555FF'>&amp;</font> A5,
        <font color='#0000FF'>const</font> T6<font color='#5555FF'>&amp;</font> A6,
        <font color='#0000FF'>const</font> T7<font color='#5555FF'>&amp;</font> A7,
        <font color='#0000FF'>const</font> T8<font color='#5555FF'>&amp;</font> A8,
        <font color='#0000FF'>const</font> T9<font color='#5555FF'>&amp;</font> A9,
        <font color='#0000FF'>const</font> T10<font color='#5555FF'>&amp;</font> A10,
        <font color='#0000FF'>const</font> T11<font color='#5555FF'>&amp;</font> A11,
        <font color='#0000FF'>const</font> T12<font color='#5555FF'>&amp;</font> A12,
        <font color='#0000FF'>const</font> T13<font color='#5555FF'>&amp;</font> A13,
        <font color='#0000FF'>const</font> T14<font color='#5555FF'>&amp;</font> A14,
        <font color='#0000FF'>const</font> T15<font color='#5555FF'>&amp;</font> A15,
        <font color='#0000FF'>const</font> T16<font color='#5555FF'>&amp;</font> A16
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_args <font color='#5555FF'>=</font> <font color='#979000'>16</font>;
        mxArray<font color='#5555FF'>*</font> plhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;
        mxArray<font color='#5555FF'>*</font> prhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;

        <font color='#0000FF'><u>int</u></font> nrhs <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A1, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A2, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A3, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A4, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A5, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A6, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A7, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A8, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A9, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A10, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A11, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A12, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A13, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A14, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A15, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A16, nrhs<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> nlhs <font color='#5555FF'>=</font> num_args <font color='#5555FF'>-</font> nrhs;
        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs, function_name<font face='Lucida Console'>)</font>;

        <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A1, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A2, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A3, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A4, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A5, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A6, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A7, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A8, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A9, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A10, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A11, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A12, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A13, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A14, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A15, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A16, i<font face='Lucida Console'>)</font>;

        free_callback_resources<font color='#5555FF'>&lt;</font>T1<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs<font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T1, 
        <font color='#0000FF'>typename</font> T2,
        <font color='#0000FF'>typename</font> T3,
        <font color='#0000FF'>typename</font> T4,
        <font color='#0000FF'>typename</font> T5,
        <font color='#0000FF'>typename</font> T6,
        <font color='#0000FF'>typename</font> T7,
        <font color='#0000FF'>typename</font> T8,
        <font color='#0000FF'>typename</font> T9,
        <font color='#0000FF'>typename</font> T10,
        <font color='#0000FF'>typename</font> T11,
        <font color='#0000FF'>typename</font> T12,
        <font color='#0000FF'>typename</font> T13,
        <font color='#0000FF'>typename</font> T14,
        <font color='#0000FF'>typename</font> T15,
        <font color='#0000FF'>typename</font> T16,
        <font color='#0000FF'>typename</font> T17
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        <font color='#0000FF'>const</font> T1<font color='#5555FF'>&amp;</font> A1,
        <font color='#0000FF'>const</font> T2<font color='#5555FF'>&amp;</font> A2,
        <font color='#0000FF'>const</font> T3<font color='#5555FF'>&amp;</font> A3,
        <font color='#0000FF'>const</font> T4<font color='#5555FF'>&amp;</font> A4,
        <font color='#0000FF'>const</font> T5<font color='#5555FF'>&amp;</font> A5,
        <font color='#0000FF'>const</font> T6<font color='#5555FF'>&amp;</font> A6,
        <font color='#0000FF'>const</font> T7<font color='#5555FF'>&amp;</font> A7,
        <font color='#0000FF'>const</font> T8<font color='#5555FF'>&amp;</font> A8,
        <font color='#0000FF'>const</font> T9<font color='#5555FF'>&amp;</font> A9,
        <font color='#0000FF'>const</font> T10<font color='#5555FF'>&amp;</font> A10,
        <font color='#0000FF'>const</font> T11<font color='#5555FF'>&amp;</font> A11,
        <font color='#0000FF'>const</font> T12<font color='#5555FF'>&amp;</font> A12,
        <font color='#0000FF'>const</font> T13<font color='#5555FF'>&amp;</font> A13,
        <font color='#0000FF'>const</font> T14<font color='#5555FF'>&amp;</font> A14,
        <font color='#0000FF'>const</font> T15<font color='#5555FF'>&amp;</font> A15,
        <font color='#0000FF'>const</font> T16<font color='#5555FF'>&amp;</font> A16,
        <font color='#0000FF'>const</font> T17<font color='#5555FF'>&amp;</font> A17
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_args <font color='#5555FF'>=</font> <font color='#979000'>17</font>;
        mxArray<font color='#5555FF'>*</font> plhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;
        mxArray<font color='#5555FF'>*</font> prhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;

        <font color='#0000FF'><u>int</u></font> nrhs <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A1, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A2, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A3, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A4, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A5, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A6, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A7, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A8, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A9, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A10, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A11, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A12, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A13, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A14, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A15, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A16, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A17, nrhs<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> nlhs <font color='#5555FF'>=</font> num_args <font color='#5555FF'>-</font> nrhs;
        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs, function_name<font face='Lucida Console'>)</font>;

        <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A1, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A2, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A3, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A4, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A5, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A6, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A7, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A8, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A9, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A10, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A11, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A12, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A13, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A14, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A15, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A16, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A17, i<font face='Lucida Console'>)</font>;

        free_callback_resources<font color='#5555FF'>&lt;</font>T1<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs<font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> T2, <font color='#0000FF'>typename</font> T3, <font color='#0000FF'>typename</font> T4, <font color='#0000FF'>typename</font> T5, <font color='#0000FF'>typename</font> T6,
        <font color='#0000FF'>typename</font> T7, <font color='#0000FF'>typename</font> T8, <font color='#0000FF'>typename</font> T9, <font color='#0000FF'>typename</font> T10, <font color='#0000FF'>typename</font> T11, <font color='#0000FF'>typename</font> T12,
        <font color='#0000FF'>typename</font> T13, <font color='#0000FF'>typename</font> T14, <font color='#0000FF'>typename</font> T15, <font color='#0000FF'>typename</font> T16, <font color='#0000FF'>typename</font> T17, <font color='#0000FF'>typename</font> T18
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        <font color='#0000FF'>const</font> T1<font color='#5555FF'>&amp;</font> A1, <font color='#0000FF'>const</font> T2<font color='#5555FF'>&amp;</font> A2, <font color='#0000FF'>const</font> T3<font color='#5555FF'>&amp;</font> A3, <font color='#0000FF'>const</font> T4<font color='#5555FF'>&amp;</font> A4, <font color='#0000FF'>const</font> T5<font color='#5555FF'>&amp;</font> A5, <font color='#0000FF'>const</font> T6<font color='#5555FF'>&amp;</font> A6,
        <font color='#0000FF'>const</font> T7<font color='#5555FF'>&amp;</font> A7, <font color='#0000FF'>const</font> T8<font color='#5555FF'>&amp;</font> A8, <font color='#0000FF'>const</font> T9<font color='#5555FF'>&amp;</font> A9, <font color='#0000FF'>const</font> T10<font color='#5555FF'>&amp;</font> A10, <font color='#0000FF'>const</font> T11<font color='#5555FF'>&amp;</font> A11, <font color='#0000FF'>const</font>
        T12<font color='#5555FF'>&amp;</font> A12, <font color='#0000FF'>const</font> T13<font color='#5555FF'>&amp;</font> A13, <font color='#0000FF'>const</font> T14<font color='#5555FF'>&amp;</font> A14, <font color='#0000FF'>const</font> T15<font color='#5555FF'>&amp;</font> A15, <font color='#0000FF'>const</font> T16<font color='#5555FF'>&amp;</font> A16, <font color='#0000FF'>const</font>
        T17<font color='#5555FF'>&amp;</font> A17, <font color='#0000FF'>const</font> T18<font color='#5555FF'>&amp;</font> A18
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_args <font color='#5555FF'>=</font> <font color='#979000'>18</font>;
        mxArray<font color='#5555FF'>*</font> plhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;
        mxArray<font color='#5555FF'>*</font> prhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;

        <font color='#0000FF'><u>int</u></font> nrhs <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A1, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A2, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A3, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A4, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A5, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A6, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A7, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A8, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A9, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A10, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A11, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A12, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A13, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A14, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A15, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A16, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A17, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A18, nrhs<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> nlhs <font color='#5555FF'>=</font> num_args <font color='#5555FF'>-</font> nrhs;
        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs, function_name<font face='Lucida Console'>)</font>;

        <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A1, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A2, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A3, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A4, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A5, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A6, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A7, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A8, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A9, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A10, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A11, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A12, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A13, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A14, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A15, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A16, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A17, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A18, i<font face='Lucida Console'>)</font>;

        free_callback_resources<font color='#5555FF'>&lt;</font>T1<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs<font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> T2, <font color='#0000FF'>typename</font> T3, <font color='#0000FF'>typename</font> T4, <font color='#0000FF'>typename</font> T5, <font color='#0000FF'>typename</font> T6,
        <font color='#0000FF'>typename</font> T7, <font color='#0000FF'>typename</font> T8, <font color='#0000FF'>typename</font> T9, <font color='#0000FF'>typename</font> T10, <font color='#0000FF'>typename</font> T11, <font color='#0000FF'>typename</font> T12,
        <font color='#0000FF'>typename</font> T13, <font color='#0000FF'>typename</font> T14, <font color='#0000FF'>typename</font> T15, <font color='#0000FF'>typename</font> T16, <font color='#0000FF'>typename</font> T17, <font color='#0000FF'>typename</font> T18,
        <font color='#0000FF'>typename</font> T19
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        <font color='#0000FF'>const</font> T1<font color='#5555FF'>&amp;</font> A1, <font color='#0000FF'>const</font> T2<font color='#5555FF'>&amp;</font> A2, <font color='#0000FF'>const</font> T3<font color='#5555FF'>&amp;</font> A3, <font color='#0000FF'>const</font> T4<font color='#5555FF'>&amp;</font> A4, <font color='#0000FF'>const</font> T5<font color='#5555FF'>&amp;</font> A5, <font color='#0000FF'>const</font> T6<font color='#5555FF'>&amp;</font> A6,
        <font color='#0000FF'>const</font> T7<font color='#5555FF'>&amp;</font> A7, <font color='#0000FF'>const</font> T8<font color='#5555FF'>&amp;</font> A8, <font color='#0000FF'>const</font> T9<font color='#5555FF'>&amp;</font> A9, <font color='#0000FF'>const</font> T10<font color='#5555FF'>&amp;</font> A10, <font color='#0000FF'>const</font> T11<font color='#5555FF'>&amp;</font> A11, <font color='#0000FF'>const</font>
        T12<font color='#5555FF'>&amp;</font> A12, <font color='#0000FF'>const</font> T13<font color='#5555FF'>&amp;</font> A13, <font color='#0000FF'>const</font> T14<font color='#5555FF'>&amp;</font> A14, <font color='#0000FF'>const</font> T15<font color='#5555FF'>&amp;</font> A15, <font color='#0000FF'>const</font> T16<font color='#5555FF'>&amp;</font> A16, <font color='#0000FF'>const</font>
        T17<font color='#5555FF'>&amp;</font> A17, <font color='#0000FF'>const</font> T18<font color='#5555FF'>&amp;</font> A18, <font color='#0000FF'>const</font> T19<font color='#5555FF'>&amp;</font> A19
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_args <font color='#5555FF'>=</font> <font color='#979000'>19</font>;
        mxArray<font color='#5555FF'>*</font> plhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;
        mxArray<font color='#5555FF'>*</font> prhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;

        <font color='#0000FF'><u>int</u></font> nrhs <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A1, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A2, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A3, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A4, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A5, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A6, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A7, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A8, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A9, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A10, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A11, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A12, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A13, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A14, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A15, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A16, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A17, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A18, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A19, nrhs<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> nlhs <font color='#5555FF'>=</font> num_args <font color='#5555FF'>-</font> nrhs;
        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs, function_name<font face='Lucida Console'>)</font>;

        <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A1, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A2, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A3, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A4, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A5, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A6, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A7, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A8, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A9, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A10, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A11, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A12, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A13, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A14, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A15, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A16, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A17, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A18, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A19, i<font face='Lucida Console'>)</font>;

        free_callback_resources<font color='#5555FF'>&lt;</font>T1<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs<font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> T1, <font color='#0000FF'>typename</font> T2, <font color='#0000FF'>typename</font> T3, <font color='#0000FF'>typename</font> T4, <font color='#0000FF'>typename</font> T5, <font color='#0000FF'>typename</font> T6,
        <font color='#0000FF'>typename</font> T7, <font color='#0000FF'>typename</font> T8, <font color='#0000FF'>typename</font> T9, <font color='#0000FF'>typename</font> T10, <font color='#0000FF'>typename</font> T11, <font color='#0000FF'>typename</font> T12,
        <font color='#0000FF'>typename</font> T13, <font color='#0000FF'>typename</font> T14, <font color='#0000FF'>typename</font> T15, <font color='#0000FF'>typename</font> T16, <font color='#0000FF'>typename</font> T17, <font color='#0000FF'>typename</font> T18,
        <font color='#0000FF'>typename</font> T19, <font color='#0000FF'>typename</font> T20
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> function_name,
        <font color='#0000FF'>const</font> T1<font color='#5555FF'>&amp;</font> A1, <font color='#0000FF'>const</font> T2<font color='#5555FF'>&amp;</font> A2, <font color='#0000FF'>const</font> T3<font color='#5555FF'>&amp;</font> A3, <font color='#0000FF'>const</font> T4<font color='#5555FF'>&amp;</font> A4, <font color='#0000FF'>const</font> T5<font color='#5555FF'>&amp;</font> A5, <font color='#0000FF'>const</font> T6<font color='#5555FF'>&amp;</font> A6,
        <font color='#0000FF'>const</font> T7<font color='#5555FF'>&amp;</font> A7, <font color='#0000FF'>const</font> T8<font color='#5555FF'>&amp;</font> A8, <font color='#0000FF'>const</font> T9<font color='#5555FF'>&amp;</font> A9, <font color='#0000FF'>const</font> T10<font color='#5555FF'>&amp;</font> A10, <font color='#0000FF'>const</font> T11<font color='#5555FF'>&amp;</font> A11, <font color='#0000FF'>const</font>
        T12<font color='#5555FF'>&amp;</font> A12, <font color='#0000FF'>const</font> T13<font color='#5555FF'>&amp;</font> A13, <font color='#0000FF'>const</font> T14<font color='#5555FF'>&amp;</font> A14, <font color='#0000FF'>const</font> T15<font color='#5555FF'>&amp;</font> A15, <font color='#0000FF'>const</font> T16<font color='#5555FF'>&amp;</font> A16, <font color='#0000FF'>const</font>
        T17<font color='#5555FF'>&amp;</font> A17, <font color='#0000FF'>const</font> T18<font color='#5555FF'>&amp;</font> A18, <font color='#0000FF'>const</font> T19<font color='#5555FF'>&amp;</font> A19, <font color='#0000FF'>const</font> T20<font color='#5555FF'>&amp;</font> A20
    <font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>using</font> <font color='#0000FF'>namespace</font> mex_binding;
        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> num_args <font color='#5555FF'>=</font> <font color='#979000'>20</font>;
        mxArray<font color='#5555FF'>*</font> plhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;
        mxArray<font color='#5555FF'>*</font> prhs[num_args] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>0</font><b>}</b>;

        <font color='#0000FF'><u>int</u></font> nrhs <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A1, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A2, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A3, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A4, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A5, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A6, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A7, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A8, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A9, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A10, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A11, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A12, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A13, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A14, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A15, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A16, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A17, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A18, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A19, nrhs<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_input_args</font><font face='Lucida Console'>(</font>prhs[nrhs], A20, nrhs<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> nlhs <font color='#5555FF'>=</font> num_args <font color='#5555FF'>-</font> nrhs;
        <font color='#BB00BB'>call_matlab_for_real</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs, function_name<font face='Lucida Console'>)</font>;

        <font color='#0000FF'><u>int</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A1, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A2, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A3, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A4, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A5, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A6, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A7, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A8, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A9, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A10, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A11, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A12, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A13, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A14, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A15, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A16, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A17, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A18, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A19, i<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>setup_output_args</font><font face='Lucida Console'>(</font>function_name, plhs[i], A20, i<font face='Lucida Console'>)</font>;

        free_callback_resources<font color='#5555FF'>&lt;</font>T1<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>nlhs,plhs,nrhs,prhs<font face='Lucida Console'>)</font>;
    <b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    matlab_struct::sub::<b><a name='operator'></a>operator</b> <b><a name='T'></a>T</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
    <b>{</b>
        T item;
        <font color='#BB00BB'>get</font><font face='Lucida Console'>(</font>item<font face='Lucida Console'>)</font>;
        <font color='#0000FF'>return</font> item;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> matlab_struct::sub::<b><a name='get'></a>get</b><font face='Lucida Console'>(</font>T<font color='#5555FF'>&amp;</font> item<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
    <b>{</b>
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>struct_handle <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
            <font color='#0000FF'>throw</font> dlib::<font color='#BB00BB'>error</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>Attempt to access data in an empty struct.</font>"<font face='Lucida Console'>)</font>;

        mxArray<font color='#5555FF'>*</font> temp <font color='#5555FF'>=</font> <font color='#BB00BB'>mxGetFieldByNumber</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>struct_handle, <font color='#979000'>0</font>, field_idx<font face='Lucida Console'>)</font>;
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>temp <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
            <font color='#0000FF'>throw</font> dlib::<font color='#BB00BB'>error</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>Attempt to access data in an empty struct.</font>"<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>try</font>
        <b>{</b>
            mex_binding::<font color='#BB00BB'>validate_and_populate_arg</font><font face='Lucida Console'>(</font><font color='#979000'>0</font>,temp,item<font face='Lucida Console'>)</font>;
        <b>}</b>
        <font color='#0000FF'>catch</font><font face='Lucida Console'>(</font>mex_binding::invalid_args_exception<font color='#5555FF'>&amp;</font> e<font face='Lucida Console'>)</font>
        <b>{</b>
            std::ostringstream sout;
            sout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>Struct field '</font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> <font color='#BB00BB'>mxGetFieldNameByNumber</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>struct_handle, field_idx<font face='Lucida Console'>)</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>' can't be interpreted as the requested type.</font>"
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> endl <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> e.msg;
            <font color='#0000FF'>throw</font> dlib::<font color='#BB00BB'>error</font><font face='Lucida Console'>(</font>sout.<font color='#BB00BB'>str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        <b>}</b>
    <b>}</b>

    <font color='#0000FF'>const</font> matlab_struct::sub matlab_struct::
    <b><a name='operator'></a>operator</b>[] <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> name<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
    <b>{</b>
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>struct_handle <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
            <font color='#0000FF'>throw</font> dlib::<font color='#BB00BB'>error</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>Struct does not have a field named '</font>" <font color='#5555FF'>+</font> name <font color='#5555FF'>+</font> "<font color='#CC0000'>'.</font>"<font face='Lucida Console'>)</font>;

        matlab_struct::sub temp;
        temp.struct_handle <font color='#5555FF'>=</font> struct_handle;
        temp.field_idx <font color='#5555FF'>=</font> <font color='#BB00BB'>mxGetFieldNumber</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>struct_handle, name.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>temp.field_idx <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#5555FF'>-</font><font color='#979000'>1</font> <font face='Lucida Console'>)</font>
            <font color='#0000FF'>throw</font> dlib::<font color='#BB00BB'>error</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>Struct does not have a field named '</font>" <font color='#5555FF'>+</font> name <font color='#5555FF'>+</font> "<font color='#CC0000'>'.</font>"<font face='Lucida Console'>)</font>;
        <font color='#0000FF'>return</font> temp;
    <b>}</b>

    matlab_struct::sub matlab_struct::
    <b><a name='operator'></a>operator</b>[] <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> name<font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>struct_handle <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#009900'>// We make a struct from scratch and mark that we will free it unless it gets
</font>            <font color='#009900'>// written back to matlab by assign_to_matlab().
</font>            mwSize dims[<font color='#979000'>1</font>] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>1</font><b>}</b>;
            <font color='#0000FF'>const</font> <font color='#0000FF'><u>char</u></font><font color='#5555FF'>*</font> name_str <font color='#5555FF'>=</font> name.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
            struct_handle <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateStructArray</font><font face='Lucida Console'>(</font><font color='#979000'>1</font>, dims, <font color='#979000'>1</font>, <font color='#5555FF'>&amp;</font>name_str<font face='Lucida Console'>)</font>;
            should_free <font color='#5555FF'>=</font> <font color='#979000'>true</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>struct_handle <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
                <font color='#0000FF'>throw</font> dlib::<font color='#BB00BB'>error</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>Error creating struct from within mex function.</font>"<font face='Lucida Console'>)</font>;
        <b>}</b>


        matlab_struct::sub temp;
        temp.struct_handle <font color='#5555FF'>=</font> struct_handle;
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>temp.field_idx<font color='#5555FF'>=</font><font color='#BB00BB'>mxGetFieldNumber</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>struct_handle, name.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>temp.field_idx<font color='#5555FF'>=</font><font color='#BB00BB'>mxAddField</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>struct_handle, name.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>throw</font> dlib::<font color='#BB00BB'>error</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>Unable to add field '</font>"<font color='#5555FF'>+</font>name <font color='#5555FF'>+</font> "<font color='#CC0000'>' to struct.</font>"<font face='Lucida Console'>)</font>;
            <b>}</b>
        <b>}</b>
        <font color='#0000FF'>return</font> temp;
    <b>}</b>

    <font color='#0000FF'>const</font> matlab_struct::sub matlab_struct::sub::
    <b><a name='operator'></a>operator</b>[] <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> name<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
    <b>{</b>
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>struct_handle <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
            <font color='#0000FF'>throw</font> dlib::<font color='#BB00BB'>error</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>Struct does not have a field named '</font>" <font color='#5555FF'>+</font> name <font color='#5555FF'>+</font> "<font color='#CC0000'>'.</font>"<font face='Lucida Console'>)</font>;

        matlab_struct::sub temp;
        temp.struct_handle <font color='#5555FF'>=</font> <font color='#BB00BB'>mxGetFieldByNumber</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>struct_handle, <font color='#979000'>0</font>, field_idx<font face='Lucida Console'>)</font>;
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>temp.struct_handle <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
            <font color='#0000FF'>throw</font> dlib::<font color='#BB00BB'>error</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>Failure to get struct field while calling mxGetFieldByNumber()</font>"<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#5555FF'>!</font><font color='#BB00BB'>mxIsStruct</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>temp.struct_handle<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
            <font color='#0000FF'>throw</font> dlib::<font color='#BB00BB'>error</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>Struct sub-field element '</font>"<font color='#5555FF'>+</font>name<font color='#5555FF'>+</font>"<font color='#CC0000'>' is not another struct.</font>"<font face='Lucida Console'>)</font>;

        temp.field_idx <font color='#5555FF'>=</font> <font color='#BB00BB'>mxGetFieldNumber</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>temp.struct_handle, name.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>temp.field_idx <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#5555FF'>-</font><font color='#979000'>1</font> <font face='Lucida Console'>)</font>
            <font color='#0000FF'>throw</font> dlib::<font color='#BB00BB'>error</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>Struct does not have a field named '</font>" <font color='#5555FF'>+</font> name <font color='#5555FF'>+</font> "<font color='#CC0000'>'.</font>"<font face='Lucida Console'>)</font>;
        <font color='#0000FF'>return</font> temp;
    <b>}</b>

    matlab_struct::sub matlab_struct::sub::
    <b><a name='operator'></a>operator</b>[] <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> name<font face='Lucida Console'>)</font> 
    <b>{</b>
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>struct_handle <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
            <font color='#0000FF'>throw</font> dlib::<font color='#BB00BB'>error</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>Struct does not have a field named '</font>" <font color='#5555FF'>+</font> name <font color='#5555FF'>+</font> "<font color='#CC0000'>'.</font>"<font face='Lucida Console'>)</font>;

        matlab_struct::sub temp;
        temp.struct_handle <font color='#5555FF'>=</font> <font color='#BB00BB'>mxGetFieldByNumber</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>struct_handle, <font color='#979000'>0</font>, field_idx<font face='Lucida Console'>)</font>;
        <font color='#009900'>// We are replacing this field with a struct if it exists and isn't already a struct
</font>        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>temp.struct_handle <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font> <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#5555FF'>!</font><font color='#BB00BB'>mxIsStruct</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>temp.struct_handle<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#BB00BB'>mxDestroyArray</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>temp.struct_handle<font face='Lucida Console'>)</font>;
            temp.struct_handle <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <b>}</b>
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>temp.struct_handle <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
        <b>{</b>
            mwSize dims[<font color='#979000'>1</font>] <font color='#5555FF'>=</font> <b>{</b><font color='#979000'>1</font><b>}</b>;
            temp.struct_handle <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateStructArray</font><font face='Lucida Console'>(</font><font color='#979000'>1</font>, dims, <font color='#979000'>0</font>, <font color='#979000'>0</font><font face='Lucida Console'>)</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>temp.struct_handle <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
                <font color='#0000FF'>throw</font> dlib::<font color='#BB00BB'>error</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>Failure to create new sub-struct field</font>"<font face='Lucida Console'>)</font>;
            <font color='#BB00BB'>mxSetFieldByNumber</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>struct_handle, <font color='#979000'>0</font>, field_idx, <font face='Lucida Console'>(</font>mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>temp.struct_handle<font face='Lucida Console'>)</font>;
        <b>}</b>


        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>temp.field_idx<font color='#5555FF'>=</font><font color='#BB00BB'>mxGetFieldNumber</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>temp.struct_handle, name.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>temp.field_idx<font color='#5555FF'>=</font><font color='#BB00BB'>mxAddField</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>temp.struct_handle, name.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#5555FF'>-</font><font color='#979000'>1</font><font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>throw</font> dlib::<font color='#BB00BB'>error</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>Unable to add field '</font>"<font color='#5555FF'>+</font>name <font color='#5555FF'>+</font> "<font color='#CC0000'>' to struct.</font>"<font face='Lucida Console'>)</font>;
            <b>}</b>
        <b>}</b>
        <font color='#0000FF'>return</font> temp;
    <b>}</b>

    <font color='#0000FF'><u>bool</u></font> matlab_struct::<b><a name='has_field'></a>has_field</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> name
    <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
    <b>{</b>
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>struct_handle <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
            <font color='#0000FF'>return</font> <font color='#979000'>false</font>;
        <font color='#0000FF'>return</font> <font color='#BB00BB'>mxGetFieldNumber</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>struct_handle, name.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font> <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#5555FF'>-</font><font color='#979000'>1</font>;
    <b>}</b>

    <font color='#0000FF'><u>bool</u></font> matlab_struct::sub::<b><a name='has_field'></a>has_field</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> std::string<font color='#5555FF'>&amp;</font> name
    <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
    <b>{</b>
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>struct_handle <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
            <font color='#0000FF'>return</font> <font color='#979000'>false</font>;
        mxArray<font color='#5555FF'>*</font> temp <font color='#5555FF'>=</font> <font color='#BB00BB'>mxGetFieldByNumber</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>struct_handle, <font color='#979000'>0</font>, field_idx<font face='Lucida Console'>)</font>;
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>temp <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>0</font> <font color='#5555FF'>|</font><font color='#5555FF'>|</font> <font color='#5555FF'>!</font><font color='#BB00BB'>mxIsStruct</font><font face='Lucida Console'>(</font>temp<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
            <font color='#0000FF'>return</font> <font color='#979000'>false</font>;
        <font color='#0000FF'>return</font> <font color='#BB00BB'>mxGetFieldNumber</font><font face='Lucida Console'>(</font>temp, name.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font> <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#5555FF'>-</font><font color='#979000'>1</font>;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    matlab_struct::sub<font color='#5555FF'>&amp;</font> matlab_struct::sub::<b><a name='operator'></a>operator</b><font color='#5555FF'>=</font> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> new_val 
    <font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#009900'>// Delete anything in the field before we overwrite it
</font>        mxArray<font color='#5555FF'>*</font> item <font color='#5555FF'>=</font> <font color='#BB00BB'>mxGetFieldByNumber</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>struct_handle, <font color='#979000'>0</font>, field_idx<font face='Lucida Console'>)</font>;
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>item <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#BB00BB'>mxDestroyArray</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>item<font face='Lucida Console'>)</font>;
            item <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <b>}</b>

        <font color='#009900'>// Now set the field
</font>        mex_binding::<font color='#BB00BB'>assign_to_matlab</font><font face='Lucida Console'>(</font>item, new_val<font face='Lucida Console'>)</font>;
        <font color='#BB00BB'>mxSetFieldByNumber</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>struct_handle, <font color='#979000'>0</font>, field_idx, item<font face='Lucida Console'>)</font>;

        <font color='#0000FF'>return</font> <font color='#5555FF'>*</font><font color='#0000FF'>this</font>;
    <b>}</b>

    matlab_struct::
    ~<b><a name='matlab_struct'></a>matlab_struct</b> <font face='Lucida Console'>(</font>
    <font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>struct_handle <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> should_free<font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#BB00BB'>mxDestroyArray</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>mxArray<font color='#5555FF'>*</font><font face='Lucida Console'>)</font>struct_handle<font face='Lucida Console'>)</font>;
            struct_handle <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        <b>}</b>
    <b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='call_matlab'></a>call_matlab</b> <font face='Lucida Console'>(</font>
        <font color='#0000FF'>const</font> function_handle<font color='#5555FF'>&amp;</font> funct 
    <font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#BB00BB'>call_matlab</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>feval</font>", funct<font face='Lucida Console'>)</font>;
    <b>}</b>

    <font color='#0000FF'>extern</font> "<font color='#CC0000'>C</font>" <font color='#0000FF'><u>bool</u></font> <b><a name='utIsInterruptPending'></a>utIsInterruptPending</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
    <font color='#0000FF'><u>void</u></font> <b><a name='check_for_matlab_ctrl_c'></a>check_for_matlab_ctrl_c</b><font face='Lucida Console'>(</font>
    <font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#BB00BB'>utIsInterruptPending</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
            <font color='#0000FF'>throw</font> mex_binding::<font color='#BB00BB'>user_hit_ctrl_c</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
    <b>}</b>
<b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font><font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'>#ifdef</font> MEX_CLASS_NAME
<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> mfp_type<font color='#5555FF'>&gt;</font>
<font color='#0000FF'>class</font> <b><a name='mex_class_wrapper'></a>mex_class_wrapper</b>
<b>{</b>
<font color='#0000FF'>public</font>:
    <b><a name='mex_class_wrapper'></a>mex_class_wrapper</b><font face='Lucida Console'>(</font>T<font color='#5555FF'>&amp;</font> obj_, mfp_type mfp_<font face='Lucida Console'>)</font> : obj<font face='Lucida Console'>(</font>obj_<font face='Lucida Console'>)</font>, mfp<font face='Lucida Console'>(</font>mfp_<font face='Lucida Console'>)</font> <b>{</b><b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font>... Args<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='operator'></a>operator</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>Args<font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font>... args<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>
    <b>{</b>
        <font face='Lucida Console'>(</font>obj.<font color='#5555FF'>*</font>mfp<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>std::forward<font color='#5555FF'>&lt;</font>Args<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>args<font face='Lucida Console'>)</font>...<font face='Lucida Console'>)</font>;
    <b>}</b>

    mfp_type mfp;
    T<font color='#5555FF'>&amp;</font> obj;
<b>}</b>;

<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> mfp_type<font color='#5555FF'>&gt;</font>
mex_class_wrapper<font color='#5555FF'>&lt;</font>T,mfp_type<font color='#5555FF'>&gt;</font> <b><a name='wrap_mex_class'></a>wrap_mex_class</b><font face='Lucida Console'>(</font>T<font color='#5555FF'>&amp;</font> obj, mfp_type mfp<font face='Lucida Console'>)</font> <b>{</b> <font color='#0000FF'>return</font> mex_class_wrapper<font color='#5555FF'>&lt;</font>T,mfp_type<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>obj, mfp<font face='Lucida Console'>)</font>; <b>}</b>

<font color='#0000FF'>namespace</font> dlib
<b>{</b>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> mfp_type<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='sig_traits'></a>sig_traits</b><font color='#5555FF'>&lt;</font>mex_class_wrapper<font color='#5555FF'>&lt;</font>T,mfp_type<font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font>
    : <font color='#0000FF'>public</font> sig_traits<font color='#5555FF'>&lt;</font>mfp_type<font color='#5555FF'>&gt;</font>
    <b>{</b><b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'><u>size_t</u></font> i, <font color='#0000FF'>typename</font> T, <font color='#0000FF'><u>bool</u></font> is_good <font color='#5555FF'>=</font> i <font color='#5555FF'>&lt;</font> std::tuple_size<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font>::value<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='tuple_element_default_void'></a>tuple_element_default_void</b>
    <b>{</b>
        <font color='#0000FF'>typedef</font> <font color='#0000FF'><u>void</u></font> type;
    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'><u>size_t</u></font> i, <font color='#0000FF'>typename</font> T<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='tuple_element_default_void'></a>tuple_element_default_void</b><font color='#5555FF'>&lt;</font>i,T,<font color='#979000'>true</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> std::tuple_element<font color='#5555FF'>&lt;</font>i,T<font color='#5555FF'>&gt;</font>::type type;
    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> class_type, <font color='#0000FF'>typename</font> return_type, <font color='#0000FF'>typename</font>... Args<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='sig_traits'></a>sig_traits</b><font color='#5555FF'>&lt;</font><b><a name='return_type'></a>return_type</b><font face='Lucida Console'>(</font>class_type::<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>Args...<font face='Lucida Console'>)</font> <font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>enum</font> <b>{</b> num_args <font color='#5555FF'>=</font> <font color='#0000FF'>sizeof</font>...<font face='Lucida Console'>(</font>Args<font face='Lucida Console'>)</font> <b>}</b>;

        <font color='#0000FF'>typedef</font> return_type result_type;

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'><u>size_t</u></font> i<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'>struct</font> <b><a name='arg'></a>arg</b>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> tuple_element_default_void<font color='#5555FF'>&lt;</font>i<font color='#5555FF'>-</font><font color='#979000'>1</font>, std::tuple<font color='#5555FF'>&lt;</font>Args...<font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font>::type type;
        <b>}</b>;

        <font color='#009900'>// These are here because that's how things are defined in sig_traits (since it is
</font>        <font color='#009900'>// older than C++11, along with most of the other code in this file)
</font>        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>1</font><font color='#5555FF'>&gt;</font>::type arg1_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>2</font><font color='#5555FF'>&gt;</font>::type arg2_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>3</font><font color='#5555FF'>&gt;</font>::type arg3_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>4</font><font color='#5555FF'>&gt;</font>::type arg4_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>5</font><font color='#5555FF'>&gt;</font>::type arg5_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>6</font><font color='#5555FF'>&gt;</font>::type arg6_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>7</font><font color='#5555FF'>&gt;</font>::type arg7_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>8</font><font color='#5555FF'>&gt;</font>::type arg8_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>9</font><font color='#5555FF'>&gt;</font>::type arg9_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>10</font><font color='#5555FF'>&gt;</font>::type arg10_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>11</font><font color='#5555FF'>&gt;</font>::type arg11_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>12</font><font color='#5555FF'>&gt;</font>::type arg12_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>13</font><font color='#5555FF'>&gt;</font>::type arg13_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>14</font><font color='#5555FF'>&gt;</font>::type arg14_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>15</font><font color='#5555FF'>&gt;</font>::type arg15_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>16</font><font color='#5555FF'>&gt;</font>::type arg16_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>17</font><font color='#5555FF'>&gt;</font>::type arg17_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>18</font><font color='#5555FF'>&gt;</font>::type arg18_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>19</font><font color='#5555FF'>&gt;</font>::type arg19_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>20</font><font color='#5555FF'>&gt;</font>::type arg20_type;
    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> class_type, <font color='#0000FF'>typename</font> return_type, <font color='#0000FF'>typename</font>... Args<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>struct</font> <b><a name='sig_traits'></a>sig_traits</b><font color='#5555FF'>&lt;</font><b><a name='return_type'></a>return_type</b><font face='Lucida Console'>(</font>class_type::<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>Args...<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font><font color='#5555FF'>&gt;</font>
    <b>{</b>
        <font color='#0000FF'>enum</font> <b>{</b> num_args <font color='#5555FF'>=</font> <font color='#0000FF'>sizeof</font>...<font face='Lucida Console'>(</font>Args<font face='Lucida Console'>)</font> <b>}</b>;

        <font color='#0000FF'>typedef</font> return_type result_type;

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'><u>size_t</u></font> i<font color='#5555FF'>&gt;</font>
        <font color='#0000FF'>struct</font> <b><a name='arg'></a>arg</b>
        <b>{</b>
            <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> tuple_element_default_void<font color='#5555FF'>&lt;</font>i<font color='#5555FF'>-</font><font color='#979000'>1</font>, std::tuple<font color='#5555FF'>&lt;</font>Args...<font color='#5555FF'>&gt;</font><font color='#5555FF'>&gt;</font>::type type;
        <b>}</b>;

        <font color='#009900'>// These are here because that's how things are defined in sig_traits (since it is
</font>        <font color='#009900'>// older than C++11, along with most of the other code in this file)
</font>        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>1</font><font color='#5555FF'>&gt;</font>::type arg1_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>2</font><font color='#5555FF'>&gt;</font>::type arg2_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>3</font><font color='#5555FF'>&gt;</font>::type arg3_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>4</font><font color='#5555FF'>&gt;</font>::type arg4_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>5</font><font color='#5555FF'>&gt;</font>::type arg5_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>6</font><font color='#5555FF'>&gt;</font>::type arg6_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>7</font><font color='#5555FF'>&gt;</font>::type arg7_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>8</font><font color='#5555FF'>&gt;</font>::type arg8_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>9</font><font color='#5555FF'>&gt;</font>::type arg9_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>10</font><font color='#5555FF'>&gt;</font>::type arg10_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>11</font><font color='#5555FF'>&gt;</font>::type arg11_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>12</font><font color='#5555FF'>&gt;</font>::type arg12_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>13</font><font color='#5555FF'>&gt;</font>::type arg13_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>14</font><font color='#5555FF'>&gt;</font>::type arg14_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>15</font><font color='#5555FF'>&gt;</font>::type arg15_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>16</font><font color='#5555FF'>&gt;</font>::type arg16_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>17</font><font color='#5555FF'>&gt;</font>::type arg17_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>18</font><font color='#5555FF'>&gt;</font>::type arg18_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>19</font><font color='#5555FF'>&gt;</font>::type arg19_type;
        <font color='#0000FF'>typedef</font> <font color='#0000FF'>typename</font> arg<font color='#5555FF'>&lt;</font><font color='#979000'>20</font><font color='#5555FF'>&gt;</font>::type arg20_type;
    <b>}</b>;
<b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>

<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'><u>size_t</u></font> I<font color='#5555FF'>&gt;</font>
<font color='#0000FF'>struct</font> <b><a name='visit_impl'></a>visit_impl</b>
<b>{</b>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> F<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>static</font> <font color='#0000FF'><u>void</u></font> <b><a name='visit'></a>visit</b><font face='Lucida Console'>(</font>T<font color='#5555FF'>&amp;</font> tup, <font color='#0000FF'><u>size_t</u></font> idx, F fun<font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>idx <font color='#5555FF'>=</font><font color='#5555FF'>=</font> I <font color='#5555FF'>-</font> <font color='#979000'>1</font><font face='Lucida Console'>)</font> <font color='#BB00BB'>fun</font><font face='Lucida Console'>(</font>std::get<font color='#5555FF'>&lt;</font>I <font color='#5555FF'>-</font> <font color='#979000'>1</font><font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>tup<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
        <font color='#0000FF'>else</font> visit_impl<font color='#5555FF'>&lt;</font>I <font color='#5555FF'>-</font> <font color='#979000'>1</font><font color='#5555FF'>&gt;</font>::<font color='#BB00BB'>visit</font><font face='Lucida Console'>(</font>tup, idx, fun<font face='Lucida Console'>)</font>;
    <b>}</b>
<b>}</b>;

<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>&gt;</font>
<font color='#0000FF'>struct</font> <b><a name='visit_impl'></a>visit_impl</b><font color='#5555FF'>&lt;</font><font color='#979000'>0</font><font color='#5555FF'>&gt;</font>
<b>{</b>
    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> F<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>static</font> <font color='#0000FF'><u>void</u></font> <b><a name='visit'></a>visit</b><font face='Lucida Console'>(</font>T<font color='#5555FF'>&amp;</font> tup, <font color='#0000FF'><u>size_t</u></font> idx, F fun<font face='Lucida Console'>)</font> <b>{</b> <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>false</font>,"<font color='#CC0000'>this should never happen</font>"<font face='Lucida Console'>)</font>; <b>}</b>
<b>}</b>;

<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> F, <font color='#0000FF'>typename</font>... Ts<font color='#5555FF'>&gt;</font>
<font color='#0000FF'><u>void</u></font> <b><a name='visit_at'></a>visit_at</b><font face='Lucida Console'>(</font>std::tuple<font color='#5555FF'>&lt;</font>Ts...<font color='#5555FF'>&gt;</font> <font color='#0000FF'>const</font><font color='#5555FF'>&amp;</font> tup, <font color='#0000FF'><u>size_t</u></font> idx, F fun<font face='Lucida Console'>)</font>
<b>{</b>
    visit_impl<font color='#5555FF'>&lt;</font><font color='#0000FF'>sizeof</font>...<font face='Lucida Console'>(</font>Ts<font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font>::<font color='#BB00BB'>visit</font><font face='Lucida Console'>(</font>tup, idx, fun<font face='Lucida Console'>)</font>;
<b>}</b>

<font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> F, <font color='#0000FF'>typename</font>... Ts<font color='#5555FF'>&gt;</font>
<font color='#0000FF'><u>void</u></font> <b><a name='visit_at'></a>visit_at</b><font face='Lucida Console'>(</font>std::tuple<font color='#5555FF'>&lt;</font>Ts...<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> tup, <font color='#0000FF'><u>size_t</u></font> idx, F fun<font face='Lucida Console'>)</font>
<b>{</b>
    visit_impl<font color='#5555FF'>&lt;</font><font color='#0000FF'>sizeof</font>...<font face='Lucida Console'>(</font>Ts<font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font>::<font color='#BB00BB'>visit</font><font face='Lucida Console'>(</font>tup, idx, fun<font face='Lucida Console'>)</font>;
<b>}</b>

<font color='#0000FF'>class</font> <b><a name='mex_class_dispatch'></a>mex_class_dispatch</b>
<b>{</b>
<font color='#0000FF'>public</font>:
    <b><a name='mex_class_dispatch'></a>mex_class_dispatch</b><font face='Lucida Console'>(</font>
        MEX_CLASS_NAME<font color='#5555FF'>*</font> ptr_,
        <font color='#0000FF'><u>int</u></font> nlhs_, 
        mxArray<font color='#5555FF'>*</font><font color='#5555FF'>*</font> plhs_,
        <font color='#0000FF'><u>int</u></font> nrhs_, 
        <font color='#0000FF'>const</font> mxArray<font color='#5555FF'>*</font><font color='#5555FF'>*</font> prhs_
    <font face='Lucida Console'>)</font> : 
        ptr<font face='Lucida Console'>(</font>ptr_<font face='Lucida Console'>)</font>,
        nlhs<font face='Lucida Console'>(</font>nlhs_<font face='Lucida Console'>)</font>,
        plhs<font face='Lucida Console'>(</font>plhs_<font face='Lucida Console'>)</font>,
        nrhs<font face='Lucida Console'>(</font>nrhs_<font face='Lucida Console'>)</font>,
        prhs<font face='Lucida Console'>(</font>prhs_<font face='Lucida Console'>)</font>
    <b>{</b><b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> funct<font color='#5555FF'>&gt;</font>
    <font color='#0000FF'><u>void</u></font> <b><a name='operator'></a>operator</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> funct<font color='#5555FF'>&amp;</font> mfp<font face='Lucida Console'>)</font>
    <b>{</b>
        mex_binding::<font color='#BB00BB'>call_mex_function</font><font face='Lucida Console'>(</font><font color='#BB00BB'>wrap_mex_class</font><font face='Lucida Console'>(</font><font color='#5555FF'>*</font>ptr,mfp<font face='Lucida Console'>)</font>, nlhs, plhs, nrhs, prhs<font face='Lucida Console'>)</font>;
    <b>}</b>

<font color='#0000FF'>private</font>:
    MEX_CLASS_NAME<font color='#5555FF'>*</font> ptr;
    <font color='#0000FF'><u>int</u></font> nlhs; 
    mxArray<font color='#5555FF'>*</font><font color='#5555FF'>*</font> plhs;
    <font color='#0000FF'><u>int</u></font> nrhs; 
    <font color='#0000FF'>const</font> mxArray<font color='#5555FF'>*</font><font color='#5555FF'>*</font> prhs;
<b>}</b>;

<font color='#0000FF'>class</font> <b><a name='class_factory_type'></a>class_factory_type</b> : dlib::noncopyable
<b>{</b>
    <font color='#009900'>/*!
        WHAT THIS OBJECT REPRESENTS
            This is a container class for all the MEX_CLASS_NAME objects we create.  It allows
            us to track what we have created and make sure the MATLAB user doesn't do any
            double frees or use any stale pointers.   

            It also helps us deal with the problem that would otherwise arise when a mex file
            is unloaded from MATLAB when there are still active pointers to MEX_CLASS_NAME objects
            in MATLAB, since we will be able to detect stale pointers.
    !*/</font>
<font color='#0000FF'>public</font>:

    <b><a name='class_factory_type'></a>class_factory_type</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
    <b>{</b>
        seed <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font>uint64<font face='Lucida Console'>)</font><font color='#BB00BB'>time</font><font face='Lucida Console'>(</font><font color='#979000'>0</font><font face='Lucida Console'>)</font>;
    <b>}</b>

    ~<b><a name='class_factory_type'></a>class_factory_type</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'>auto</font> i : object_table<font face='Lucida Console'>)</font>
            <font color='#0000FF'>delete</font> i.second;
    <b>}</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font><font color='#0000FF'>typename</font> ...T<font color='#5555FF'>&gt;</font>
    uint64 <b><a name='create'></a>create</b><font face='Lucida Console'>(</font>T<font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> ...args<font face='Lucida Console'>)</font>
    <b>{</b>
        MEX_CLASS_NAME<font color='#5555FF'>*</font> item <font color='#5555FF'>=</font> <font color='#0000FF'>new</font> <font color='#BB00BB'>MEX_CLASS_NAME</font><font face='Lucida Console'>(</font>std::forward<font color='#5555FF'>&lt;</font>T<font color='#5555FF'>&gt;</font><font face='Lucida Console'>(</font>args<font face='Lucida Console'>)</font>...<font face='Lucida Console'>)</font>;
        uint64 id <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font>uint64<font face='Lucida Console'>)</font>item;
        <font color='#009900'>// Now generate a unique id that incorporates our seed value. The point of doing
</font>        <font color='#009900'>// this is to avoid any chance that a mex file will get unloaded and then reloaded
</font>        <font color='#009900'>// and start constructing objects with the same addresses, while old stale objects
</font>        <font color='#009900'>// at those addresses are still stored in matlab, which would then call into the
</font>        <font color='#009900'>// mex file and make things go crazy.  So here we try to generate ID numbers that
</font>        <font color='#009900'>// are globally unique.
</font>        uint64 i <font color='#5555FF'>=</font> <font color='#979000'>0</font>;
        id <font color='#5555FF'>=</font> <font color='#BB00BB'>murmur_hash3_128bit_3</font><font face='Lucida Console'>(</font>id, seed, <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>.first;
        <font color='#009900'>// very unlikely but make sure there aren't any hash collisions.
</font>        <font color='#0000FF'>while</font><font face='Lucida Console'>(</font>object_table.<font color='#BB00BB'>count</font><font face='Lucida Console'>(</font>id<font face='Lucida Console'>)</font> <font color='#5555FF'>!</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
            id <font color='#5555FF'>=</font> <font color='#BB00BB'>murmur_hash3_128bit_3</font><font face='Lucida Console'>(</font>id, seed, <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>.first;

        object_table[id] <font color='#5555FF'>=</font> item;
        <font color='#0000FF'>return</font> id;
    <b>}</b>

    <font color='#0000FF'><u>void</u></font> <b><a name='free'></a>free</b><font face='Lucida Console'>(</font>uint64 item<font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>object_table.<font color='#BB00BB'>count</font><font face='Lucida Console'>(</font>item<font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'>throw</font> dlib::<font color='#BB00BB'>error</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>An attempt to deallocate a mex class object with an invalid pointer was detected.</font>"<font face='Lucida Console'>)</font>;
        <b>}</b>

        <font color='#0000FF'>delete</font> object_table[item];
        object_table.<font color='#BB00BB'>erase</font><font face='Lucida Console'>(</font>item<font face='Lucida Console'>)</font>;
    <b>}</b>

    MEX_CLASS_NAME<font color='#5555FF'>*</font> <b><a name='access'></a>access</b><font face='Lucida Console'>(</font>uint64 item<font face='Lucida Console'>)</font> <font color='#009900'>// convert numeric ID to pointer to object that can be used.
</font>    <b>{</b>
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>object_table.<font color='#BB00BB'>count</font><font face='Lucida Console'>(</font>item<font face='Lucida Console'>)</font> <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'>throw</font> dlib::<font color='#BB00BB'>error</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>An attempt to access a mex class object with an invalid pointer was detected.</font>"<font face='Lucida Console'>)</font>;
        <b>}</b>

        <font color='#0000FF'>return</font> object_table[item];
    <b>}</b>

<font color='#0000FF'>private</font>:

    std::map<font color='#5555FF'>&lt;</font>uint64, MEX_CLASS_NAME<font color='#5555FF'>*</font><font color='#5555FF'>&gt;</font> object_table;
    uint64 seed;
<b>}</b> class_factory;

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#009900'>// Make a FOREACH macro
</font><font color='#0000FF'>#define</font> FE_1<font face='Lucida Console'>(</font>WHAT, X<font face='Lucida Console'>)</font> WHAT<font face='Lucida Console'>(</font>X<font face='Lucida Console'>)</font> 
<font color='#0000FF'>#define</font> FE_2<font face='Lucida Console'>(</font>WHAT, X, ...<font face='Lucida Console'>)</font> WHAT<font face='Lucida Console'>(</font>X<font face='Lucida Console'>)</font>,FE_1<font face='Lucida Console'>(</font>WHAT, __VA_ARGS__<font face='Lucida Console'>)</font>
<font color='#0000FF'>#define</font> FE_3<font face='Lucida Console'>(</font>WHAT, X, ...<font face='Lucida Console'>)</font> WHAT<font face='Lucida Console'>(</font>X<font face='Lucida Console'>)</font>,FE_2<font face='Lucida Console'>(</font>WHAT, __VA_ARGS__<font face='Lucida Console'>)</font>
<font color='#0000FF'>#define</font> FE_4<font face='Lucida Console'>(</font>WHAT, X, ...<font face='Lucida Console'>)</font> WHAT<font face='Lucida Console'>(</font>X<font face='Lucida Console'>)</font>,FE_3<font face='Lucida Console'>(</font>WHAT, __VA_ARGS__<font face='Lucida Console'>)</font>
<font color='#0000FF'>#define</font> FE_5<font face='Lucida Console'>(</font>WHAT, X, ...<font face='Lucida Console'>)</font> WHAT<font face='Lucida Console'>(</font>X<font face='Lucida Console'>)</font>,FE_4<font face='Lucida Console'>(</font>WHAT, __VA_ARGS__<font face='Lucida Console'>)</font>
<font color='#0000FF'>#define</font> FE_6<font face='Lucida Console'>(</font>WHAT, X, ...<font face='Lucida Console'>)</font> WHAT<font face='Lucida Console'>(</font>X<font face='Lucida Console'>)</font>,FE_5<font face='Lucida Console'>(</font>WHAT, __VA_ARGS__<font face='Lucida Console'>)</font>
<font color='#0000FF'>#define</font> FE_7<font face='Lucida Console'>(</font>WHAT, X, ...<font face='Lucida Console'>)</font> WHAT<font face='Lucida Console'>(</font>X<font face='Lucida Console'>)</font>,FE_6<font face='Lucida Console'>(</font>WHAT, __VA_ARGS__<font face='Lucida Console'>)</font>
<font color='#0000FF'>#define</font> FE_8<font face='Lucida Console'>(</font>WHAT, X, ...<font face='Lucida Console'>)</font> WHAT<font face='Lucida Console'>(</font>X<font face='Lucida Console'>)</font>,FE_7<font face='Lucida Console'>(</font>WHAT, __VA_ARGS__<font face='Lucida Console'>)</font>
<font color='#0000FF'>#define</font> FE_9<font face='Lucida Console'>(</font>WHAT, X, ...<font face='Lucida Console'>)</font> WHAT<font face='Lucida Console'>(</font>X<font face='Lucida Console'>)</font>,FE_8<font face='Lucida Console'>(</font>WHAT, __VA_ARGS__<font face='Lucida Console'>)</font>
<font color='#0000FF'>#define</font> FE_10<font face='Lucida Console'>(</font>WHAT, X, ...<font face='Lucida Console'>)</font> WHAT<font face='Lucida Console'>(</font>X<font face='Lucida Console'>)</font>,FE_9<font face='Lucida Console'>(</font>WHAT, __VA_ARGS__<font face='Lucida Console'>)</font>
<font color='#0000FF'>#define</font> FE_11<font face='Lucida Console'>(</font>WHAT, X, ...<font face='Lucida Console'>)</font> WHAT<font face='Lucida Console'>(</font>X<font face='Lucida Console'>)</font>,FE_10<font face='Lucida Console'>(</font>WHAT, __VA_ARGS__<font face='Lucida Console'>)</font>
<font color='#0000FF'>#define</font> FE_12<font face='Lucida Console'>(</font>WHAT, X, ...<font face='Lucida Console'>)</font> WHAT<font face='Lucida Console'>(</font>X<font face='Lucida Console'>)</font>,FE_11<font face='Lucida Console'>(</font>WHAT, __VA_ARGS__<font face='Lucida Console'>)</font>
<font color='#0000FF'>#define</font> FE_13<font face='Lucida Console'>(</font>WHAT, X, ...<font face='Lucida Console'>)</font> WHAT<font face='Lucida Console'>(</font>X<font face='Lucida Console'>)</font>,FE_12<font face='Lucida Console'>(</font>WHAT, __VA_ARGS__<font face='Lucida Console'>)</font>
<font color='#0000FF'>#define</font> FE_14<font face='Lucida Console'>(</font>WHAT, X, ...<font face='Lucida Console'>)</font> WHAT<font face='Lucida Console'>(</font>X<font face='Lucida Console'>)</font>,FE_13<font face='Lucida Console'>(</font>WHAT, __VA_ARGS__<font face='Lucida Console'>)</font>
<font color='#0000FF'>#define</font> FE_15<font face='Lucida Console'>(</font>WHAT, X, ...<font face='Lucida Console'>)</font> WHAT<font face='Lucida Console'>(</font>X<font face='Lucida Console'>)</font>,FE_14<font face='Lucida Console'>(</font>WHAT, __VA_ARGS__<font face='Lucida Console'>)</font>
<font color='#0000FF'>#define</font> FE_16<font face='Lucida Console'>(</font>WHAT, X, ...<font face='Lucida Console'>)</font> WHAT<font face='Lucida Console'>(</font>X<font face='Lucida Console'>)</font>,FE_15<font face='Lucida Console'>(</font>WHAT, __VA_ARGS__<font face='Lucida Console'>)</font>
<font color='#0000FF'>#define</font> FE_17<font face='Lucida Console'>(</font>WHAT, X, ...<font face='Lucida Console'>)</font> WHAT<font face='Lucida Console'>(</font>X<font face='Lucida Console'>)</font>,FE_16<font face='Lucida Console'>(</font>WHAT, __VA_ARGS__<font face='Lucida Console'>)</font>
<font color='#0000FF'>#define</font> FE_18<font face='Lucida Console'>(</font>WHAT, X, ...<font face='Lucida Console'>)</font> WHAT<font face='Lucida Console'>(</font>X<font face='Lucida Console'>)</font>,FE_17<font face='Lucida Console'>(</font>WHAT, __VA_ARGS__<font face='Lucida Console'>)</font>
<font color='#0000FF'>#define</font> FE_19<font face='Lucida Console'>(</font>WHAT, X, ...<font face='Lucida Console'>)</font> WHAT<font face='Lucida Console'>(</font>X<font face='Lucida Console'>)</font>,FE_18<font face='Lucida Console'>(</font>WHAT, __VA_ARGS__<font face='Lucida Console'>)</font>
<font color='#0000FF'>#define</font> FE_20<font face='Lucida Console'>(</font>WHAT, X, ...<font face='Lucida Console'>)</font> WHAT<font face='Lucida Console'>(</font>X<font face='Lucida Console'>)</font>,FE_19<font face='Lucida Console'>(</font>WHAT, __VA_ARGS__<font face='Lucida Console'>)</font>
<font color='#009900'>//... repeat as needed
</font><font color='#0000FF'>#define</font> GET_MACRO<font face='Lucida Console'>(</font>_1,_2,_3,_4,_5,_6,_7,_8,_9,_10,_11,_12,_13,_14,_15,_16,_17,_18,_19,_20,NAME,...<font face='Lucida Console'>)</font> NAME 
<font color='#0000FF'>#define</font> FOR_EACH<font face='Lucida Console'>(</font>action,...<font face='Lucida Console'>)</font> GET_MACRO<font face='Lucida Console'>(</font>__VA_ARGS__,FE_20,FE_19,FE_18,FE_17,FE_16,FE_15,FE_14,FE_13,FE_12,FE_11,FE_10,FE_9,FE_8,FE_7,FE_6,FE_5,FE_4,FE_3,FE_2,FE_1<font face='Lucida Console'>)</font><font face='Lucida Console'>(</font>action,__VA_ARGS__<font face='Lucida Console'>)</font>
<font color='#0000FF'>#define</font> MEX_CLASS_ANNOTATE<font face='Lucida Console'>(</font>x<font face='Lucida Console'>)</font> <font color='#5555FF'>&amp;</font>MEX_CLASS_NAME::x 

<font color='#009900'>// Now make a tuple containing all the member function pointers to our MEX_CLASS_NAME
</font><font color='#0000FF'>auto</font> mex_class_methods <font color='#5555FF'>=</font> std::<b><a name='make_tuple'></a>make_tuple</b><font face='Lucida Console'>(</font><font color='#BB00BB'>FOR_EACH</font><font face='Lucida Console'>(</font>MEX_CLASS_ANNOTATE, MEX_CLASS_METHODS<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;


<font color='#0000FF'>#endif</font> <font color='#009900'>// MEX_CLASS_NAME
</font>
<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#0000FF'><u>bool</u></font> <b><a name='is_string'></a>is_string</b><font face='Lucida Console'>(</font><font color='#0000FF'>const</font> mxArray<font color='#5555FF'>*</font> arr, <font color='#0000FF'>const</font> <font color='#0000FF'><u>char</u></font><font color='#5555FF'>*</font> str<font face='Lucida Console'>)</font>
<b>{</b>
    <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#BB00BB'>mxIsChar</font><font face='Lucida Console'>(</font>arr<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#0000FF'><u>char</u></font> ch[<font color='#979000'>20</font>];
        <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font><font color='#BB00BB'>mxGetString</font><font face='Lucida Console'>(</font>arr, ch, <font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font>ch<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font><font color='#5555FF'>=</font><font color='#5555FF'>=</font><font color='#979000'>0</font>, "<font color='#CC0000'>Unable to retrieve string</font>"<font face='Lucida Console'>)</font>;
        ch[<font color='#0000FF'>sizeof</font><font face='Lucida Console'>(</font>ch<font face='Lucida Console'>)</font><font color='#5555FF'>-</font><font color='#979000'>1</font>] <font color='#5555FF'>=</font> <font color='#979000'>0</font>;<font color='#009900'>// ensure NULL termination regardless of what MATLAB does.
</font>        <font color='#0000FF'>return</font> <font color='#BB00BB'>strcmp</font><font face='Lucida Console'>(</font>str,ch<font face='Lucida Console'>)</font><font color='#5555FF'>=</font><font color='#5555FF'>=</font><font color='#979000'>0</font>;
    <b>}</b>
    <font color='#0000FF'>return</font> <font color='#979000'>false</font>;
<b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>
<font color='#009900'>/* The gateway function called by MATLAB*/</font>
<font color='#0000FF'><u>void</u></font> <b><a name='mexFunction'></a>mexFunction</b><font face='Lucida Console'>(</font> <font color='#0000FF'><u>int</u></font> nlhs, mxArray <font color='#5555FF'>*</font>plhs[],
                  <font color='#0000FF'><u>int</u></font> nrhs, <font color='#0000FF'>const</font> mxArray <font color='#5555FF'>*</font>prhs[]<font face='Lucida Console'>)</font>
<b>{</b>
    <font color='#009900'>// Only remap cout and cerr if we aren't using octave since octave already does this.
</font><font color='#0000FF'>#if</font> <font color='#5555FF'>!</font>defined<font face='Lucida Console'>(</font>OCTAVE_IMPORT<font face='Lucida Console'>)</font> <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#5555FF'>!</font>defined<font face='Lucida Console'>(</font>OCTAVE_API<font face='Lucida Console'>)</font>
    <font color='#009900'>// make it so cout prints to mexPrintf()
</font>    mex_binding::mex_streambuf sb;
    <font color='#009900'>// make it so cerr prints to mexWarnMsgTxt()
</font>    mex_binding::mex_warn_streambuf wsb;
<font color='#0000FF'>#endif</font>

    <font color='#0000FF'>try</font>
    <b>{</b>
<font color='#0000FF'>#ifdef</font> MEX_CLASS_NAME
        <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>nrhs <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>0</font><font face='Lucida Console'>)</font>
        <b>{</b>
            <font color='#0000FF'>#define</font> DEF2STR<font face='Lucida Console'>(</font>x<font face='Lucida Console'>)</font> DEF2STR2<font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>x<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
            <font color='#0000FF'>#define</font> DEF2STR2<font face='Lucida Console'>(</font>x<font face='Lucida Console'>)</font> #x

            string classname <font color='#5555FF'>=</font> <font color='#BB00BB'>trim</font><font face='Lucida Console'>(</font><font color='#BB00BB'>string</font><font face='Lucida Console'>(</font><font color='#BB00BB'>DEF2STR</font><font face='Lucida Console'>(</font>MEX_CLASS_NAME<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>, "<font color='#CC0000'> \t()</font>"<font face='Lucida Console'>)</font>;
            std::vector<font color='#5555FF'>&lt;</font>string<font color='#5555FF'>&gt;</font> methods <font color='#5555FF'>=</font> <font color='#BB00BB'>split</font><font face='Lucida Console'>(</font><font color='#BB00BB'>trim</font><font face='Lucida Console'>(</font><font color='#BB00BB'>string</font><font face='Lucida Console'>(</font><font color='#BB00BB'>DEF2STR</font><font face='Lucida Console'>(</font>MEX_CLASS_METHODS<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>, "<font color='#CC0000'> \t()</font>"<font face='Lucida Console'>)</font>, "<font color='#CC0000'> \t,</font>"<font face='Lucida Console'>)</font>;

            string mex_filename <font color='#5555FF'>=</font> "<font color='#CC0000'>mex_</font>"<font color='#5555FF'>+</font>classname;
            <font color='#0000FF'><u>bool</u></font> has_load_obj <font color='#5555FF'>=</font> <font color='#979000'>false</font>;
            <font color='#0000FF'><u>size_t</u></font> load_obj_idx <font color='#5555FF'>=</font> <font color='#979000'>0</font>;

            cout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>classdef </font>" <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> classname <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'> &lt; handle\n</font>"
                 <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>    properties (Access = private)\n</font>"
                 <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>        cpp_ptr\n</font>"
                 <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>    end\n</font>"
                 <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n</font>"
                 <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>    methods\n</font>"
                 <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>        function this = </font>"<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>classname<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>"<font color='#CC0000'>()\n</font>"
                 <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>            this.cpp_ptr = </font>"<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>mex_filename<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>"<font color='#CC0000'>('construct');\n</font>"
                 <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>        end\n</font>"
                 <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n</font>"
                 <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>        function copied_obj = clone(this)\n</font>"
                 <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>            %Returns a new independent object that is a copy of this.\n</font>"
                 <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>            copied_obj = </font>"<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>classname<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>"<font color='#CC0000'>();\n</font>"
                 <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>            copied_obj.cpp_ptr = </font>"<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>mex_filename<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>"<font color='#CC0000'>(this.cpp_ptr,'clone');\n</font>"
                 <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>        end\n</font>"
                 <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>\n</font>";
            <font color='#0000FF'>for</font> <font face='Lucida Console'>(</font><font color='#0000FF'><u>size_t</u></font> i <font color='#5555FF'>=</font> <font color='#979000'>0</font>; i <font color='#5555FF'>&lt;</font> methods.<font color='#BB00BB'>size</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <font color='#5555FF'>+</font><font color='#5555FF'>+</font>i<font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>methods[i] <font color='#5555FF'>=</font><font color='#5555FF'>=</font> "<font color='#CC0000'>load_obj</font>"<font face='Lucida Console'>)</font>
                <b>{</b>
                    has_load_obj <font color='#5555FF'>=</font> <font color='#979000'>true</font>;
                    load_obj_idx <font color='#5555FF'>=</font> i;
                <b>}</b>
                <font color='#0000FF'>else</font>
                <b>{</b>
                    cout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>        function varargout = </font>"<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>methods[i]<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>"<font color='#CC0000'>(this, varargin) \n</font>"
                        <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>            [varargout{1:nargout}] = </font>"<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>mex_filename<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>"<font color='#CC0000'>(this.cpp_ptr, </font>"<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>i<font color='#5555FF'>+</font><font color='#979000'>1</font><font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>"<font color='#CC0000'>, varargin{:}); \n</font>"
                        <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>        end \n\n</font>";
                <b>}</b>
            <b>}</b>
            cout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>    end\n\n</font>";

            cout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>    methods(Access=private) \n</font>"
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>        function delete(this) \n</font>"
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>            </font>"<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>mex_filename<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>"<font color='#CC0000'>(this.cpp_ptr); \n</font>"
                <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>        end         \n</font>";
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>has_load_obj<font face='Lucida Console'>)</font>
            <b>{</b>
                cout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>        function varargout = load_obj(this, varargin) \n</font>"
                    <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>            [varargout{1:nargout}] = </font>"<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>mex_filename<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>"<font color='#CC0000'>(this.cpp_ptr, </font>"<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>load_obj_idx<font color='#5555FF'>+</font><font color='#979000'>1</font><font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>"<font color='#CC0000'>, varargin{:}); \n</font>"
                    <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>        end \n</font>";
            <b>}</b>
            cout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>    end \n\n</font>";

            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>has_load_obj<font face='Lucida Console'>)</font>
            <b>{</b>
                cout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>    methods(Static) \n</font>"
                    <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>        function this = loadobj(in) \n</font>"
                    <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>            this = </font>"<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>classname<font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font>"<font color='#CC0000'>(); \n</font>"
                    <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>            this.load_obj(in); \n</font>"
                    <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>        end          \n</font>"
                    <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>    end \n</font>"
                    <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> "<font color='#CC0000'>end \n</font>";
            <b>}</b>
        <b>}</b>
        <font color='#0000FF'>else</font> <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font>nrhs <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>1</font><font face='Lucida Console'>)</font> 
        <b>{</b>
            <font color='#009900'>// this is a constructor call
</font>            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#BB00BB'>is_string</font><font face='Lucida Console'>(</font>prhs[<font color='#979000'>0</font>],"<font color='#CC0000'>construct</font>"<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font>nlhs <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>1</font>, "<font color='#CC0000'>If you want to construct a new object then you must assign the pointer to something.</font>"<font face='Lucida Console'>)</font>;
                plhs[<font color='#979000'>0</font>] <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateNumericMatrix</font><font face='Lucida Console'>(</font><font color='#979000'>1</font>, <font color='#979000'>1</font>, mxUINT64_CLASS, mxREAL<font face='Lucida Console'>)</font>;
                uint64<font color='#5555FF'>*</font> ptr_int <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font>uint64<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>plhs[<font color='#979000'>0</font>]<font face='Lucida Console'>)</font>;
                <font color='#5555FF'>*</font>ptr_int <font color='#5555FF'>=</font> class_factory.<font color='#BB00BB'>create</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>;
            <b>}</b>
            <font color='#0000FF'>else</font> <font color='#009900'>// destructor call
</font>            <b>{</b>
                <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font><font color='#BB00BB'>mxIsUint64</font><font face='Lucida Console'>(</font>prhs[<font color='#979000'>0</font>]<font face='Lucida Console'>)</font> <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#BB00BB'>mxGetNumberOfElements</font><font face='Lucida Console'>(</font>prhs[<font color='#979000'>0</font>]<font face='Lucida Console'>)</font><font color='#5555FF'>=</font><font color='#5555FF'>=</font><font color='#979000'>1</font>, "<font color='#CC0000'>When calling a class destructor the first argument must be a pointer (a UINT64 in matlab)</font>"<font face='Lucida Console'>)</font>;
                <font color='#0000FF'>const</font> uint64 ptr_int <font color='#5555FF'>=</font> <font color='#5555FF'>*</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>uint64<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>prhs[<font color='#979000'>0</font>]<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
                class_factory.<font color='#BB00BB'>free</font><font face='Lucida Console'>(</font>ptr_int<font face='Lucida Console'>)</font>;
            <b>}</b>
        <b>}</b>
        <font color='#0000FF'>else</font> <font color='#009900'>// a regular function call
</font>        <b>{</b>
            <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font><font color='#BB00BB'>mxIsUint64</font><font face='Lucida Console'>(</font>prhs[<font color='#979000'>0</font>]<font face='Lucida Console'>)</font> <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#BB00BB'>mxGetNumberOfElements</font><font face='Lucida Console'>(</font>prhs[<font color='#979000'>0</font>]<font face='Lucida Console'>)</font><font color='#5555FF'>=</font><font color='#5555FF'>=</font><font color='#979000'>1</font>, "<font color='#CC0000'>When calling a class member function the first argument must be a pointer (a UINT64 in matlab)</font>"<font face='Lucida Console'>)</font>;
            <font color='#0000FF'>if</font> <font face='Lucida Console'>(</font><font color='#BB00BB'>is_string</font><font face='Lucida Console'>(</font>prhs[<font color='#979000'>1</font>], "<font color='#CC0000'>clone</font>"<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>
            <b>{</b>
                <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font>nlhs <font color='#5555FF'>=</font><font color='#5555FF'>=</font> <font color='#979000'>1</font>, "<font color='#CC0000'>If you want to construct a new object then you must assign the pointer to something.</font>"<font face='Lucida Console'>)</font>;
                <font color='#0000FF'>const</font> uint64 ptr_int <font color='#5555FF'>=</font> <font color='#5555FF'>*</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>uint64<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>prhs[<font color='#979000'>0</font>]<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;

                MEX_CLASS_NAME<font color='#5555FF'>*</font> ptr <font color='#5555FF'>=</font> class_factory.<font color='#BB00BB'>access</font><font face='Lucida Console'>(</font>ptr_int<font face='Lucida Console'>)</font>;

                plhs[<font color='#979000'>0</font>] <font color='#5555FF'>=</font> <font color='#BB00BB'>mxCreateNumericMatrix</font><font face='Lucida Console'>(</font><font color='#979000'>1</font>, <font color='#979000'>1</font>, mxUINT64_CLASS, mxREAL<font face='Lucida Console'>)</font>;
                uint64<font color='#5555FF'>*</font> ptr_int2 <font color='#5555FF'>=</font> <font face='Lucida Console'>(</font>uint64<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>plhs[<font color='#979000'>0</font>]<font face='Lucida Console'>)</font>;
                <font color='#009900'>// copy construct a new object
</font>                <font color='#5555FF'>*</font>ptr_int2 <font color='#5555FF'>=</font> class_factory.<font color='#BB00BB'>create</font><font face='Lucida Console'>(</font><font color='#5555FF'>*</font>ptr<font face='Lucida Console'>)</font>;
            <b>}</b>
            <font color='#0000FF'>else</font>
            <b>{</b>
                <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font><font color='#BB00BB'>mxIsDouble</font><font face='Lucida Console'>(</font>prhs[<font color='#979000'>1</font>]<font face='Lucida Console'>)</font> <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> <font color='#BB00BB'>mxGetNumberOfElements</font><font face='Lucida Console'>(</font>prhs[<font color='#979000'>1</font>]<font face='Lucida Console'>)</font><font color='#5555FF'>=</font><font color='#5555FF'>=</font><font color='#979000'>1</font>, "<font color='#CC0000'>When calling a class member function the second argument must be a number indicating which member function</font>"<font face='Lucida Console'>)</font>;
                <font color='#0000FF'>const</font> uint64 ptr_int <font color='#5555FF'>=</font> <font color='#5555FF'>*</font><font face='Lucida Console'>(</font><font face='Lucida Console'>(</font>uint64<font color='#5555FF'>*</font><font face='Lucida Console'>)</font><font color='#BB00BB'>mxGetData</font><font face='Lucida Console'>(</font>prhs[<font color='#979000'>0</font>]<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
                <font color='#0000FF'>const</font> <font color='#0000FF'><u>int</u></font> funct_idx <font color='#5555FF'>=</font> <font color='#5555FF'>*</font><font face='Lucida Console'>(</font><font color='#BB00BB'>mxGetPr</font><font face='Lucida Console'>(</font>prhs[<font color='#979000'>1</font>]<font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;

                <font color='#0000FF'>auto</font> num_registered_functions <font color='#5555FF'>=</font> std::tuple_size<font color='#5555FF'>&lt;</font><font color='#BB00BB'>decltype</font><font face='Lucida Console'>(</font>mex_class_methods<font face='Lucida Console'>)</font><font color='#5555FF'>&gt;</font>::value;
                <font color='#BB00BB'>DLIB_CASSERT</font><font face='Lucida Console'>(</font><font color='#979000'>1</font> <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> funct_idx <font color='#5555FF'>&amp;</font><font color='#5555FF'>&amp;</font> funct_idx <font color='#5555FF'>&lt;</font><font color='#5555FF'>=</font> num_registered_functions, "<font color='#CC0000'>Invalid function index provided.</font>"<font face='Lucida Console'>)</font>;

                MEX_CLASS_NAME<font color='#5555FF'>*</font> ptr <font color='#5555FF'>=</font> class_factory.<font color='#BB00BB'>access</font><font face='Lucida Console'>(</font>ptr_int<font face='Lucida Console'>)</font>;

                <font color='#009900'>// we used the first two arguments to decide what function to call.  So adjust nrhs
</font>                <font color='#009900'>// and prhs so the member function never sees them.
</font>                mex_class_dispatch <font color='#BB00BB'>dispatch</font><font face='Lucida Console'>(</font>ptr, nlhs, plhs, nrhs<font color='#5555FF'>-</font><font color='#979000'>2</font>, prhs<font color='#5555FF'>+</font><font color='#979000'>2</font><font face='Lucida Console'>)</font>;
                <font color='#009900'>// now invoke the member function,  subtract 1 to convert to 0 indexing.
</font>                <font color='#BB00BB'>visit_at</font><font face='Lucida Console'>(</font>mex_class_methods, funct_idx<font color='#5555FF'>-</font><font color='#979000'>1</font>, dispatch<font face='Lucida Console'>)</font>;
            <b>}</b>
        <b>}</b>
<font color='#0000FF'>#else</font>
        mex_binding::<font color='#BB00BB'>call_mex_function</font><font face='Lucida Console'>(</font>mex_function, nlhs, plhs, nrhs, prhs<font face='Lucida Console'>)</font>;
<font color='#0000FF'>#endif</font>
    <b>}</b>
    <font color='#0000FF'>catch</font> <font face='Lucida Console'>(</font>mex_binding::invalid_args_exception<font color='#5555FF'>&amp;</font> e<font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#BB00BB'>mexErrMsgIdAndTxt</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>mex_function:validate_and_populate_arg</font>",
                            <font face='Lucida Console'>(</font>"<font color='#CC0000'>Input</font>" <font color='#5555FF'>+</font> e.msg<font face='Lucida Console'>)</font>.<font color='#BB00BB'>c_str</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
    <b>}</b>
    <font color='#0000FF'>catch</font> <font face='Lucida Console'>(</font>mex_binding::user_hit_ctrl_c<font color='#5555FF'>&amp;</font> <font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#009900'>// do nothing, just return to matlab
</font>    <b>}</b>
    <font color='#0000FF'>catch</font> <font face='Lucida Console'>(</font>std::exception<font color='#5555FF'>&amp;</font> e<font face='Lucida Console'>)</font>
    <b>{</b>
        <font color='#BB00BB'>mexErrMsgIdAndTxt</font><font face='Lucida Console'>(</font>"<font color='#CC0000'>mex_function:error</font>",
                            e.<font color='#BB00BB'>what</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font><font face='Lucida Console'>)</font>;
    <b>}</b>

    cout <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> flush;
    cerr <font color='#5555FF'>&lt;</font><font color='#5555FF'>&lt;</font> flush;
<b>}</b>

<font color='#009900'>// ----------------------------------------------------------------------------------------
</font>

</pre></body></html>